mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 23:33:13 +08:00
Remove deprecated --tags option in console commands
This commit is contained in:
@@ -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'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user