setName('backup:pin') ->setDescription('Keep a snapshot: the retention policy does not remove a pinned one') ->addArgument('target', InputArgument::REQUIRED, 'Location name or id') ->addArgument('snapshot', InputArgument::REQUIRED, 'Snapshot id (see backup:list)') ->addOption('unpin', null, InputOption::VALUE_NONE, 'Leave the snapshot to the retention policy again'); } protected function execute(InputInterface $input, OutputInterface $output): int { $unpin = (bool)$input->getOption('unpin'); try { $this->prune->setPinned($this->targets->get($input->getArgument('target')), $input->getArgument('snapshot'), !$unpin); } catch (\Throwable $e) { $output->writeln('' . $e->getMessage() . ''); return 1; } $output->writeln($unpin ? 'Snapshot unpinned; the retention policy applies to it again.' : 'Snapshot pinned; the retention policy leaves it alone.'); return 0; } }