Remove deprecated --tags option in console commands

This commit is contained in:
Alejandro Celaya
2025-11-08 10:21:06 +01:00
parent fdcc9933a3
commit 359129f586
4 changed files with 6 additions and 15 deletions

View File

@@ -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',

View File

@@ -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'));
}
}