Skip to content

Commit 8a33c69

Browse files
authored
Merge pull request #2525 from acelaya-forks/remove-tags-option
Remove deprecated --tags option in console commands
2 parents fdcc993 + 359129f commit 8a33c69

File tree

4 files changed

+6
-15
lines changed

4 files changed

+6
-15
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
2020
* [#2517](https://github.com/shlinkio/shlink/issues/2517) Remove `REDIRECT_APPEND_EXTRA_PATH` env var. Use `REDIRECT_EXTRA_PATH_MODE=append` instead.
2121
* [#2519](https://github.com/shlinkio/shlink/issues/2519) Disabling API keys by their plain-text key is no longer supported. When calling `api-key:disable`, the first argument is now always assumed to be the name.
2222
* [#2520](https://github.com/shlinkio/shlink/issues/2520) Remove deprecated `--including-all-tags` and `--show-api-key-name` deprecated options from `short-url:list` command. Use `--tags-all` and `--show-api-key` instead.
23+
* [#2521](https://github.com/shlinkio/shlink/issues/2521) Remove deprecated `--tags` option in all commands using it. Use `--tag` multiple times instead, one per tag.
2324

2425
### Fixed
2526
* *Nothing*

module/CLI/src/Command/ShortUrl/ListShortUrlsCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ protected function configure(): void
7676
->addOption(
7777
'tags-all',
7878
mode: InputOption::VALUE_NONE,
79-
description: 'If --tags is provided, returns only short URLs including ALL of them',
79+
description: 'If --tag is provided, returns only short URLs including ALL of them',
8080
)
8181
->addOption(
8282
'exclude-tag',

module/CLI/src/Input/TagsOption.php

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
use Symfony\Component\Console\Input\InputInterface;
99
use Symfony\Component\Console\Input\InputOption;
1010

11-
use function array_map;
1211
use function array_unique;
13-
use function Shlinkio\Shlink\Core\ArrayUtils\flatten;
14-
use function Shlinkio\Shlink\Core\splitByComma;
1512

1613
readonly class TagsOption
1714
{
@@ -23,29 +20,22 @@ public function __construct(Command $command, string $description)
2320
't',
2421
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
2522
$description,
26-
)
27-
->addOption(
28-
'tags',
29-
mode: InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
30-
description: '[DEPRECATED] Use --tag instead',
3123
);
3224
}
3325

3426
/**
35-
* Whether tags have been set or not, via `--tag`, `-t` or the deprecated `--tags`
27+
* Whether tags have been set or not, via `--tag` or `-t`
3628
*/
3729
public function exists(InputInterface $input): bool
3830
{
39-
return $input->hasParameterOption(['--tag', '-t']) || $input->hasParameterOption('--tags');
31+
return $input->hasParameterOption(['--tag', '-t']);
4032
}
4133

4234
/**
4335
* @return string[]
4436
*/
4537
public function get(InputInterface $input): array
4638
{
47-
// FIXME DEPRECATED Remove support for comma-separated tags in next major release
48-
$tags = [...$input->getOption('tag'), ...$input->getOption('tags')];
49-
return array_unique(flatten(array_map(splitByComma(...), $tags)));
39+
return array_unique($input->getOption('tag'));
5040
}
5141
}

module/CLI/test/Command/ShortUrl/CreateShortUrlCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function properlyProcessesProvidedTags(): void
9595

9696
$this->commandTester->execute([
9797
'longUrl' => 'http://domain.com/foo/bar',
98-
'--tags' => ['foo,bar', 'baz', 'boo,zar,baz'],
98+
'--tag' => ['foo', 'bar', 'baz', 'boo', 'zar', 'baz'],
9999
]);
100100
$output = $this->commandTester->getDisplay();
101101

0 commit comments

Comments
 (0)