diff options
Diffstat (limited to 'lib/Command')
-rw-r--r-- | lib/Command/Config/OpmlExport.php | 50 | ||||
-rw-r--r-- | lib/Command/ShowFeed.php | 11 |
2 files changed, 61 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; + } +} diff --git a/lib/Command/ShowFeed.php b/lib/Command/ShowFeed.php index 1218279e6..8aace3528 100644 --- a/lib/Command/ShowFeed.php +++ b/lib/Command/ShowFeed.php @@ -50,6 +50,9 @@ class ShowFeed extends Command $this->feedFetcher = $feedFetcher; } + /** + * Configure the command + */ protected function configure() { $this->setName('news:show-feed') @@ -60,6 +63,14 @@ class ShowFeed extends Command ->addOption('full-text', 'f', InputOption::VALUE_NONE, 'Usa a scraper to get full text'); } + /** + * Execute the command + * + * @param InputInterface $input + * @param OutputInterface $output + * + * @return int + */ protected function execute(InputInterface $input, OutputInterface $output): int { $url = $input->getArgument('feed'); |