aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle/Command
diff options
context:
space:
mode:
authorJeremy Benoist <j0k3r@users.noreply.github.com>2016-09-26 14:47:02 +0200
committerGitHub <noreply@github.com>2016-09-26 14:47:02 +0200
commitd6de23a100221ae1afaa92a58af17a17d0c6614e (patch)
treebd105198c75ea6b8e5d37a80a9f0135942a1c5eb /src/Wallabag/ImportBundle/Command
parent7e98ad962680fac17b3b90ae34b9c6e5afe7636f (diff)
parentfefef9d41b4d1bd9efbd49011159bae70bf67528 (diff)
downloadwallabag-d6de23a100221ae1afaa92a58af17a17d0c6614e.tar.gz
wallabag-d6de23a100221ae1afaa92a58af17a17d0c6614e.tar.zst
wallabag-d6de23a100221ae1afaa92a58af17a17d0c6614e.zip
Merge pull request #2192 from wallabag/import-browser-bookmarks
Import Firefox & Chrome bookmarks into wallabag
Diffstat (limited to 'src/Wallabag/ImportBundle/Command')
-rw-r--r--src/Wallabag/ImportBundle/Command/ImportCommand.php20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/Wallabag/ImportBundle/Command/ImportCommand.php b/src/Wallabag/ImportBundle/Command/ImportCommand.php
index 20ecc6e1..1df38295 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, firefox or chrome', '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,20 @@ 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 'firefox':
48 $wallabag = $this->getContainer()->get('wallabag_import.firefox.import');
49 break;
50 case 'chrome':
51 $wallabag = $this->getContainer()->get('wallabag_import.chrome.import');
52 break;
53 case 'v1':
54 default:
55 $wallabag = $this->getContainer()->get('wallabag_import.wallabag_v1.import');
56 break;
47 } 57 }
48 58
49 $wallabag->setMarkAsRead($input->getOption('markAsRead')); 59 $wallabag->setMarkAsRead($input->getOption('markAsRead'));