Skip to content

Commit 2c83ed2

Browse files
committed
Change "category" to "group" in PublishViewsCommand
Fixes #2142
1 parent 1747d6c commit 2c83ed2

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ This serves two purposes:
5454
- **Breaking:** The custom navigation item configuration now uses array inputs instead of the previous format. For more information, see the upgrade guide below.
5555
- **Breaking:** Renamed the `hyde.navigation.subdirectories` configuration option to `hyde.navigation.subdirectory_display`.
5656
- **Breaking:** Renamed the `hyde.enable_cache_busting` configuration option to `hyde.cache_busting` in https://github.com/hydephp/develop/pull/1980
57+
- Renamed the parameter `category` to `group` in the `publish:views` command in https://github.com/hydephp/develop/pull/2142
5758
- Dependency: Upgraded from Laravel 10 to Laravel 11
5859
- Dependency: Updated minimum PHP requirement to 8.2
5960
- Dependency: Updated Symfony/yaml to ^7.0

docs/getting-started/console-commands.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,16 +222,16 @@ Publish one of the default homepages as `index.blade.php`.
222222
<a name="publish-views" style="display: inline-block; position: absolute; margin-top: -5rem;"></a>
223223
224224
```bash
225-
php hyde publish:views [<category>]
225+
php hyde publish:views [<group>]
226226
```
227227
228228
Publish the hyde components for customization. Note that existing files will be overwritten.
229229
230230
#### Arguments
231231
232-
| | |
233-
|------------|-------------------------|
234-
| `category` | The category to publish |
232+
| | |
233+
|----------|-------------------------|
234+
| `group` | The group to publish |
235235
236236
## Display All Registered Routes.
237237

packages/framework/src/Console/Commands/PublishViewsCommand.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
class PublishViewsCommand extends Command
2626
{
2727
/** @var string */
28-
protected $signature = 'publish:views {category? : The category to publish}';
28+
protected $signature = 'publish:views {group? : The group to publish}';
2929

3030
/** @var string */
3131
protected $description = 'Publish the Hyde components for customization. Note that existing files will be overwritten';
@@ -40,10 +40,10 @@ public function handle(): int
4040
ViewPublishGroup::fromGroup('hyde-components', 'Blade Components', 'More or less self contained components, extracted for customizability and DRY code'),
4141
]);
4242

43-
$selected = ($this->argument('category') ?? $this->promptForCategory()) ?: 'all';
43+
$selected = ($this->argument('group') ?? $this->promptForGroup()) ?: 'all';
4444

45-
if ($selected !== 'all' && (bool) $this->argument('category') === false && ConsoleHelper::canUseLaravelPrompts($this->input)) {
46-
$this->infoComment(sprintf('Selected category [%s]', $selected));
45+
if ($selected !== 'all' && (bool) $this->argument('group') === false && ConsoleHelper::canUseLaravelPrompts($this->input)) {
46+
$this->infoComment(sprintf('Selected group [%s]', $selected));
4747
}
4848

4949
if (! in_array($selected, $allowed = array_merge(['all'], array_keys($this->options)), true)) {
@@ -64,22 +64,22 @@ public function handle(): int
6464
return Command::SUCCESS;
6565
}
6666

67-
protected function promptForCategory(): string
67+
protected function promptForGroup(): string
6868
{
6969
SelectPrompt::fallbackUsing(function (SelectPrompt $prompt): string {
7070
return $this->choice($prompt->label, $prompt->options, $prompt->default);
7171
});
7272

7373
return $this->parseChoiceIntoKey(
74-
select('Which category do you want to publish?', $this->formatPublishableChoices(), 0) ?: 'all'
74+
select('Which group do you want to publish?', $this->formatPublishableChoices(), 0) ?: 'all'
7575
);
7676
}
7777

7878
protected function formatPublishableChoices(): array
7979
{
8080
return collect($this->options)
8181
->map(fn (ViewPublishGroup $option, string $key): string => sprintf('<comment>%s</comment>: %s', $key, $option->description))
82-
->prepend('Publish all categories listed below')
82+
->prepend('Publish all groups listed below')
8383
->values()
8484
->all();
8585
}

packages/framework/tests/Feature/Commands/PublishViewsCommandTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public function testCommandPublishesViews()
3030
+ Filesystem::findFiles('vendor/hyde/framework/resources/views/layouts', '.blade.php', true)->count();
3131

3232
$this->artisan('publish:views')
33-
->expectsQuestion('Which category do you want to publish?', 'all')
34-
->doesntExpectOutputToContain('Selected category')
33+
->expectsQuestion('Which group do you want to publish?', 'all')
34+
->doesntExpectOutputToContain('Selected group')
3535
->expectsOutput("Published all $count files to [resources/views/vendor/hyde]")
3636
->assertExitCode(0);
3737

@@ -76,7 +76,7 @@ public function testCanSelectGroupWithQuestion()
7676
ConsoleHelper::disableLaravelPrompts();
7777

7878
$this->artisan('publish:views')
79-
->expectsQuestion('Which category do you want to publish?', '<comment>layouts</comment>: Shared layout views, such as the app layout, navigation menu, and Markdown page templates')
79+
->expectsQuestion('Which group do you want to publish?', '<comment>layouts</comment>: Shared layout views, such as the app layout, navigation menu, and Markdown page templates')
8080
->expectsOutput('Published all [layout] files to [resources/views/vendor/hyde/layouts]')
8181
->assertExitCode(0);
8282

@@ -213,8 +213,8 @@ public function testCanSelectGroupWithQuestionAndPrompts()
213213
}
214214

215215
$this->artisan('publish:views')
216-
->expectsQuestion('Which category do you want to publish?', '<comment>layouts</comment>: Shared layout views, such as the app layout, navigation menu, and Markdown page templates')
217-
->expectsOutput('Selected category [layouts]')
216+
->expectsQuestion('Which group do you want to publish?', '<comment>layouts</comment>: Shared layout views, such as the app layout, navigation menu, and Markdown page templates')
217+
->expectsOutput('Selected group [layouts]')
218218
->expectsQuestion('Select the files you want to publish', [(is_dir(Hyde::path('packages')) ? 'packages' : 'vendor/hyde').'/framework/resources/views/layouts/app.blade.php'])
219219
->expectsOutput('Published selected file to [resources/views/vendor/hyde/layouts/app.blade.php]')
220220
->assertExitCode(0);
@@ -229,7 +229,7 @@ public function testCanSelectGroupWithQuestionAndPrompts()
229229
protected function executePublishViewsCommand(): BufferedOutput
230230
{
231231
$command = (new PublishViewsCommand());
232-
$input = new ArrayInput(['category' => 'layouts'], $command->getDefinition());
232+
$input = new ArrayInput(['group' => 'layouts'], $command->getDefinition());
233233
$output = new BufferedOutput();
234234
$command->setInput($input);
235235
$command->setOutput(new OutputStyle($input, $output));

0 commit comments

Comments
 (0)