aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle/Command
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2016-07-12 13:51:05 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-09-25 12:28:54 +0200
commitae669126e718ede5dbf76929215d8514cd960976 (patch)
treef7da9fa833014eaec0cc2cfade514df2cc117188 /src/Wallabag/ImportBundle/Command
parent9d7dd6b0d2480d3efff5b0ab1461f2ef99bfd57a (diff)
downloadwallabag-ae669126e718ede5dbf76929215d8514cd960976.tar.gz
wallabag-ae669126e718ede5dbf76929215d8514cd960976.tar.zst
wallabag-ae669126e718ede5dbf76929215d8514cd960976.zip
Import Firefox & Chrome bookmarks into wallabag
Diffstat (limited to 'src/Wallabag/ImportBundle/Command')
-rw-r--r--src/Wallabag/ImportBundle/Command/ImportCommand.php19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/Wallabag/ImportBundle/Command/ImportCommand.php b/src/Wallabag/ImportBundle/Command/ImportCommand.php
index 20ecc6e1..537dffc2 100644
--- a/src/Wallabag/ImportBundle/Command/ImportCommand.php
+++ b/src/Wallabag/ImportBundle/Command/ImportCommand.php
@@ -17,7 +17,7 @@ class ImportCommand extends ContainerAwareCommand
17 ->setDescription('Import entries from a JSON export from a wallabag v1 instance') 17 ->setDescription('Import entries from a JSON export from a wallabag v1 instance')
18 ->addArgument('userId', InputArgument::REQUIRED, 'User ID to populate') 18 ->addArgument('userId', InputArgument::REQUIRED, 'User ID to populate')
19 ->addArgument('filepath', InputArgument::REQUIRED, 'Path to the JSON file') 19 ->addArgument('filepath', InputArgument::REQUIRED, 'Path to the JSON file')
20 ->addOption('importer', null, InputArgument::OPTIONAL, 'The importer to use: v1 or v2', 'v1') 20 ->addOption('importer', null, InputArgument::OPTIONAL, 'The importer to use: wallabag v1, v2 or browser', 'v1')
21 ->addOption('markAsRead', null, InputArgument::OPTIONAL, 'Mark all entries as read', false) 21 ->addOption('markAsRead', null, InputArgument::OPTIONAL, 'Mark all entries as read', false)
22 ; 22 ;
23 } 23 }
@@ -40,10 +40,19 @@ class ImportCommand extends ContainerAwareCommand
40 throw new Exception(sprintf('User with id "%s" not found', $input->getArgument('userId'))); 40 throw new Exception(sprintf('User with id "%s" not found', $input->getArgument('userId')));
41 } 41 }
42 42
43 $wallabag = $this->getContainer()->get('wallabag_import.wallabag_v1.import'); 43 switch ($input->getOption('importer')) {
44 44 case 'v2':
45 if ('v2' === $input->getOption('importer')) { 45 $wallabag = $this->getContainer()->get('wallabag_import.wallabag_v2.import');
46 $wallabag = $this->getContainer()->get('wallabag_import.wallabag_v2.import'); 46 break;
47 case 'v1':
48 $wallabag = $this->getContainer()->get('wallabag_import.wallabag_v1.import');
49 break;
50 case 'browser':
51 $wallabag = $this->getContainer()->get('wallabag_import.browser.import');
52 break;
53 default:
54 $wallabag = $this->getContainer()->get('wallabag_import.wallabag_v1.import');
55 break;
47 } 56 }
48 57
49 $wallabag->setMarkAsRead($input->getOption('markAsRead')); 58 $wallabag->setMarkAsRead($input->getOption('markAsRead'));