addArgument('paths', InputArgument::IS_ARRAY, 'Paths to purge, e.g. /products/aligo');
$this->addOption('all', null, InputOption::VALUE_NONE, 'Purge the whole cache ("*")');
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$paths = $input->getOption('all') ? ['*'] : (array)$input->getArgument('paths');
if ($paths === []) {
$output->writeln('No paths given (use arguments or --all).');
return Command::INVALID;
}
$result = $this->purgeService->purge($paths, 'cli');
$output->writeln(sprintf(
'%s HTTP %d - %s (paths: %s)',
$result['success'] ? 'OK' : 'FAILED',
$result['httpCode'],
$result['message'],
implode(', ', $result['paths'])
));
return $result['success'] ? Command::SUCCESS : Command::FAILURE;
}
}