Enhance option in command

This commit is contained in:
Nicolas Lœuillet 2016-04-28 13:41:36 +02:00
parent 3fad6c74fe
commit 235026e2c7
3 changed files with 6 additions and 8 deletions

View file

@ -52,7 +52,7 @@ Please replace values:
* ``1`` is the user identifier in database (The ID of the first user created on wallabag is 1)
* ``~/Downloads/wallabag-export-1-2016-04-05.json`` is the path of your wallabag v1 export
If you want to mark all these entries as read, you can add the ``--markAsRead=yes`` option.
If you want to mark all these entries as read, you can add the ``--markAsRead`` option.
To import a wallabag v2 file, you need to add the option ``--importer=v2``.

View file

@ -38,8 +38,8 @@ Depuis votre nouvelle instance de wallabag, créez votre compte utilisateur puis
.. note::
S'il vous arrive des problèmes durant l'export ou l'import, n'hésitez pas à `demander de l'aide <https://www.wallabag.org/pages/support.html>`__.
Import via via la ligne de commande (CLI)
-----------------------------------------
Import via la ligne de commande (CLI)
-------------------------------------
Si vous avez accès à la ligne de commandes de votre serveur web, vous pouvez exécuter cette commande pour import votre fichier wallabag v1 :
@ -52,7 +52,7 @@ Remplacez les valeurs :
* ``1`` est l'identifiant de votre utilisateur en base (l'ID de votre premier utilisateur créé sur wallabag est 1)
* ``~/Downloads/wallabag-export-1-2016-04-05.json`` est le chemin de votre export wallabag v1
Si vous voulez marquer tous ces articles comme lus, vous pouvez ajouter l'option ``--markAsRead=yes``.
Si vous voulez marquer tous ces articles comme lus, vous pouvez ajouter l'option ``--markAsRead``.
Pour importer un fichier wallabag v2, vous devez ajouter l'option ``--importer=v2``.

View file

@ -18,7 +18,7 @@ class ImportCommand extends ContainerAwareCommand
->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)
->addOption('markAsRead', null, InputArgument::OPTIONAL, 'Mark all entries as read', false)
;
}
@ -42,9 +42,7 @@ class ImportCommand extends ContainerAwareCommand
$wallabag = $this->getContainer()->get('wallabag_import.wallabag_v2.import');
}
if ('yes' === $input->getOption('markAsRead')) {
$wallabag->setMarkAsRead(true);
}
$wallabag->setMarkAsRead($input->getOption('markAsRead'));
$res = $wallabag
->setUser($user)