diff options
Diffstat (limited to 'lib/Command/Config/OpmlExport.php')
-rw-r--r-- | lib/Command/Config/OpmlExport.php | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/lib/Command/Config/OpmlExport.php b/lib/Command/Config/OpmlExport.php new file mode 100644 index 000000000..1642e8505 --- /dev/null +++ b/lib/Command/Config/OpmlExport.php @@ -0,0 +1,50 @@ +<?php + +namespace OCA\News\Command\Config; + +use OCA\News\Service\OpmlService; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +class OpmlExport extends Command +{ + /** + * @var OpmlService service for the data. + */ + protected $opmlService; + + public function __construct(OpmlService $opmlService) + { + parent::__construct(null); + + $this->opmlService = $opmlService; + } + + /** + * Configure command + */ + protected function configure() + { + $this->setName('news:opml:export') + ->setDescription('Print OPML file') + ->addArgument('userID', InputArgument::REQUIRED, 'User data to export'); + } + + /** + * Execute command + * + * @param InputInterface $input + * @param OutputInterface $output + * + * @return int|void + */ + protected function execute(InputInterface $input, OutputInterface $output): int + { + $user = $input->getArgument('userID'); + + $output->write($this->opmlService->export($user)); + return 0; + } +} |