mirror of
https://github.com/shlinkio/shlink.git
synced 2025-12-10 11:05:50 -06:00
Remove deprecated --tags option in console commands
This commit is contained in:
parent
fdcc9933a3
commit
359129f586
@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
|
||||
* [#2517](https://github.com/shlinkio/shlink/issues/2517) Remove `REDIRECT_APPEND_EXTRA_PATH` env var. Use `REDIRECT_EXTRA_PATH_MODE=append` instead.
|
||||
* [#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.
|
||||
* [#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.
|
||||
* [#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.
|
||||
|
||||
### Fixed
|
||||
* *Nothing*
|
||||
|
||||
@ -76,7 +76,7 @@ class ListShortUrlsCommand extends Command
|
||||
->addOption(
|
||||
'tags-all',
|
||||
mode: InputOption::VALUE_NONE,
|
||||
description: 'If --tags is provided, returns only short URLs including ALL of them',
|
||||
description: 'If --tag is provided, returns only short URLs including ALL of them',
|
||||
)
|
||||
->addOption(
|
||||
'exclude-tag',
|
||||
|
||||
@ -8,10 +8,7 @@ use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
use function array_map;
|
||||
use function array_unique;
|
||||
use function Shlinkio\Shlink\Core\ArrayUtils\flatten;
|
||||
use function Shlinkio\Shlink\Core\splitByComma;
|
||||
|
||||
readonly class TagsOption
|
||||
{
|
||||
@ -23,20 +20,15 @@ readonly class TagsOption
|
||||
't',
|
||||
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
|
||||
$description,
|
||||
)
|
||||
->addOption(
|
||||
'tags',
|
||||
mode: InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
|
||||
description: '[DEPRECATED] Use --tag instead',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether tags have been set or not, via `--tag`, `-t` or the deprecated `--tags`
|
||||
* Whether tags have been set or not, via `--tag` or `-t`
|
||||
*/
|
||||
public function exists(InputInterface $input): bool
|
||||
{
|
||||
return $input->hasParameterOption(['--tag', '-t']) || $input->hasParameterOption('--tags');
|
||||
return $input->hasParameterOption(['--tag', '-t']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -44,8 +36,6 @@ readonly class TagsOption
|
||||
*/
|
||||
public function get(InputInterface $input): array
|
||||
{
|
||||
// FIXME DEPRECATED Remove support for comma-separated tags in next major release
|
||||
$tags = [...$input->getOption('tag'), ...$input->getOption('tags')];
|
||||
return array_unique(flatten(array_map(splitByComma(...), $tags)));
|
||||
return array_unique($input->getOption('tag'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ class CreateShortUrlCommandTest extends TestCase
|
||||
|
||||
$this->commandTester->execute([
|
||||
'longUrl' => 'http://domain.com/foo/bar',
|
||||
'--tags' => ['foo,bar', 'baz', 'boo,zar,baz'],
|
||||
'--tag' => ['foo', 'bar', 'baz', 'boo', 'zar', 'baz'],
|
||||
]);
|
||||
$output = $this->commandTester->getDisplay();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user