From 3fad6c74fe72b50bceb5f1c67c3f81370660634e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Wed, 27 Apr 2016 20:30:24 +0200 Subject: Add CLI import for wallabag v2 files --- src/Wallabag/ImportBundle/Command/ImportCommand.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/Wallabag/ImportBundle/Command') diff --git a/src/Wallabag/ImportBundle/Command/ImportCommand.php b/src/Wallabag/ImportBundle/Command/ImportCommand.php index dfbfc2f7..f62176fc 100644 --- a/src/Wallabag/ImportBundle/Command/ImportCommand.php +++ b/src/Wallabag/ImportBundle/Command/ImportCommand.php @@ -13,10 +13,12 @@ class ImportCommand extends ContainerAwareCommand protected function configure() { $this - ->setName('wallabag:import-v1') + ->setName('wallabag:import') ->setDescription('Import entries from a JSON export from a wallabag v1 instance') ->addArgument('userId', InputArgument::REQUIRED, 'User ID to populate') ->addArgument('filepath', InputArgument::REQUIRED, 'Path to the JSON file') + ->addOption('importer', null, InputArgument::OPTIONAL, 'The importer to use: v1 or v2', 'v1') + ->addOption('markAsRead', null, InputArgument::OPTIONAL, 'Mark all entries as read: true/false', false) ; } @@ -35,6 +37,15 @@ class ImportCommand extends ContainerAwareCommand } $wallabag = $this->getContainer()->get('wallabag_import.wallabag_v1.import'); + + if ('v2' === $input->getOption('importer')) { + $wallabag = $this->getContainer()->get('wallabag_import.wallabag_v2.import'); + } + + if ('yes' === $input->getOption('markAsRead')) { + $wallabag->setMarkAsRead(true); + } + $res = $wallabag ->setUser($user) ->setFilepath($input->getArgument('filepath')) -- cgit v1.2.3