From 38b5b5ada5fec453ddd9a9d2c99c7e6a9fc09442 Mon Sep 17 00:00:00 2001
From: Adrien Waksberg <git@yae.im>
Date: Thu, 20 Oct 2016 08:32:26 +0200
Subject: [PATCH] fix translation options

---
 bin/mpw-add    |  6 +++---
 bin/mpw-config | 21 ++++++++++-----------
 bin/mpw-delete |  8 ++++----
 bin/mpw-export |  8 ++++----
 bin/mpw-genpwd |  2 +-
 bin/mpw-import |  6 +++---
 bin/mpw-list   |  8 ++++----
 bin/mpw-update | 10 +++++-----
 bin/mpw-wallet |  4 ++--
 i18n/en.yml    | 11 +++++++++--
 i18n/fr.yml    | 11 +++++++++--
 11 files changed, 54 insertions(+), 41 deletions(-)

diff --git a/bin/mpw-add b/bin/mpw-add
index 52537c0..883f75d 100644
--- a/bin/mpw-add
+++ b/bin/mpw-add
@@ -27,9 +27,9 @@ require 'mpw/cli'
 options = {}
 
 OptionParser.new do |opts|
-	opts.banner = "#{I18n.t('option.usage')}: mpw [options]"
+	opts.banner = "#{I18n.t('option.usage')}: mpw add [options]"
 
-	opts.on('-c', '--config CONFIG', I18n.t('option.config')) do |config|
+	opts.on('-c', '--config PATH', I18n.t('option.config')) do |config|
 		options[:config] = config
 	end
 
@@ -38,7 +38,7 @@ OptionParser.new do |opts|
 		exit 0
 	end
 
-	opts.on('-w', '--wallet WALLET', I18n.t('option.wallet')) do |wallet|
+	opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
 		options[:wallet] = wallet
 	end
 end.parse!
diff --git a/bin/mpw-config b/bin/mpw-config
index d29a93c..a215150 100644
--- a/bin/mpw-config
+++ b/bin/mpw-config
@@ -27,13 +27,13 @@ require 'mpw/cli'
 options = {}
 
 OptionParser.new do |opts|
-	opts.banner = "#{I18n.t('option.usage')}: mpw [options]"
+	opts.banner = "#{I18n.t('option.usage')}: mpw config [options]"
 
-	opts.on('-c', '--config CONFIG', I18n.t('option.config')) do |config|
+	opts.on('-c', '--config PATH', I18n.t('option.config')) do |config|
 		options[:config] = config
 	end
 
-	opts.on('-g', '--gpg-exe PATH', I18n.t('option.lang')) do |gpg_exe|
+	opts.on('-g', '--gpg-exe PATH', I18n.t('option.gpg_exe')) do |gpg_exe|
 		options[:gpg_exe] = gpg_exe
 	end
 
@@ -42,11 +42,11 @@ OptionParser.new do |opts|
 		exit 0
 	end
 
-	opts.on('--init', I18n.t('option.init')) do
-		options[:init] = true
+	opts.on('-i', '--init GPG_KEY', I18n.t('option.init')) do |gpg_key|
+		options[:init] = gpg_key
 	end
 
-	opts.on('-k', '--key GPG_KEY', I18n.t('option.lang')) do |gpg_key|
+	opts.on('-k', '--key GPG_KEY', I18n.t('option.gpg_key')) do |gpg_key|
 		options[:gpg_key] = gpg_key
 	end
 
@@ -54,7 +54,7 @@ OptionParser.new do |opts|
 		options[:lang] = lang
 	end
 
-	opts.on('-w', '--wallet-dir LANG', I18n.t('option.lang')) do |wallet_dir|
+	opts.on('-w', '--wallet-dir PATH', I18n.t('option.wallet_dir')) do |wallet_dir|
 		options[:wallet_dir] = wallet_dir
 	end
 end.parse!
@@ -64,9 +64,8 @@ cli    = MPW::Cli.new(config, nil, nil, nil)
 
 if not options[:init].nil?
 	cli.setup(options)
-	cli.setup_gpg_key(options[:gpg_key]) if not config.check_gpg_key?
+	cli.setup_gpg_key(options[:init])
 	cli.setup_wallet_config
-	exit 0
+else
+	cli.set_config(options)
 end
-
-cli.set_config(options)
diff --git a/bin/mpw-delete b/bin/mpw-delete
index a7e95e8..7974ff6 100644
--- a/bin/mpw-delete
+++ b/bin/mpw-delete
@@ -29,11 +29,11 @@ options = {}
 OptionParser.new do |opts|
 	opts.banner = "#{I18n.t('option.usage')}: mpw delete [options]"
 
-	opts.on('-c', '--config CONFIG', I18n.t('option.config')) do |config|
+	opts.on('-c', '--config PATH', I18n.t('option.config')) do |config|
 		options[:config] = config
 	end
 
-	opts.on('-g', '--group GROUP', I18n.t('option.config')) do |group|
+	opts.on('-g', '--group NAME', I18n.t('option.group')) do |group|
 		options[:group] = group
 	end
 
@@ -42,11 +42,11 @@ OptionParser.new do |opts|
 		exit 0
 	end
 
-	opts.on('-p', '--pattern PATTERN', I18n.t('option.config')) do |pattern|
+	opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern|
 		options[:pattern] = pattern
 	end
 
-	opts.on('-w', '--wallet WALLET', I18n.t('option.wallet')) do |wallet|
+	opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
 		options[:wallet] = wallet
 	end
 end.parse!
diff --git a/bin/mpw-export b/bin/mpw-export
index 700d067..15a9f9b 100644
--- a/bin/mpw-export
+++ b/bin/mpw-export
@@ -33,11 +33,11 @@ OptionParser.new do |opts|
 		options[:config] = config
 	end
 
-	opts.on('-f', '--file PATH', I18n.t('option.file')) do |file|
+	opts.on('-f', '--file PATH', I18n.t('option.file_export')) do |file|
 		options[:file] = file
 	end
 
-	opts.on('-g', '--group GROUP', I18n.t('option.config')) do |group|
+	opts.on('-g', '--group GROUP', I18n.t('option.group')) do |group|
 		options[:group] = group
 	end
 
@@ -46,11 +46,11 @@ OptionParser.new do |opts|
 		exit 0
 	end
 
-	opts.on('-p', '--pattern PATTERN', I18n.t('option.config')) do |pattern|
+	opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern|
 		options[:pattern] = pattern
 	end
 
-	opts.on('-w', '--wallet WALLET', I18n.t('option.wallet')) do |wallet|
+	opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
 		options[:wallet] = wallet
 	end
 end.parse!
diff --git a/bin/mpw-genpwd b/bin/mpw-genpwd
index c99d002..8af4290 100644
--- a/bin/mpw-genpwd
+++ b/bin/mpw-genpwd
@@ -22,7 +22,7 @@ require 'mpw/mpw'
 options = {}
 
 OptionParser.new do |opts|
-	opts.banner = "#{I18n.t('option.usage')}: mpw-passwd [options]"
+	opts.banner = "#{I18n.t('option.usage')}: mpw passwd [options]"
 
 	opts.on('-h', '--help', I18n.t('option.help')) do
 		puts opts
diff --git a/bin/mpw-import b/bin/mpw-import
index 61b5d8c..335ebf4 100644
--- a/bin/mpw-import
+++ b/bin/mpw-import
@@ -27,13 +27,13 @@ require 'mpw/cli'
 options = {}
 
 OptionParser.new do |opts|
-	opts.banner = "#{I18n.t('option.usage')}: mpw wallet [options]"
+	opts.banner = "#{I18n.t('option.usage')}: mpw import [options]"
 
 	opts.on('-c', '--config PATH', I18n.t('option.config')) do |config|
 		options[:config] = config
 	end
 
-	opts.on('-f', '--file PATH', I18n.t('option.file')) do |file|
+	opts.on('-f', '--file PATH', I18n.t('option.file_import')) do |file|
 		options[:file] = file
 	end
 
@@ -42,7 +42,7 @@ OptionParser.new do |opts|
 		exit 0
 	end
 
-	opts.on('-w', '--wallet WALLET', I18n.t('option.wallet')) do |wallet|
+	opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
 		options[:wallet] = wallet
 	end
 end.parse!
diff --git a/bin/mpw-list b/bin/mpw-list
index 9bde1ff..984a3b0 100644
--- a/bin/mpw-list
+++ b/bin/mpw-list
@@ -29,11 +29,11 @@ options = {}
 OptionParser.new do |opts|
 	opts.banner = "#{I18n.t('option.usage')}: mpw list [options]"
 
-	opts.on('-c', '--config CONFIG', I18n.t('option.config')) do |config|
+	opts.on('-c', '--config PATH', I18n.t('option.config')) do |config|
 		options[:config] = config
 	end
 
-	opts.on('-g', '--group GROUP', I18n.t('option.config')) do |group|
+	opts.on('-g', '--group NAME', I18n.t('option.group')) do |group|
 		options[:group] = group
 	end
 
@@ -42,11 +42,11 @@ OptionParser.new do |opts|
 		exit 0
 	end
 
-	opts.on('-p', '--pattern PATTERN', I18n.t('option.config')) do |pattern|
+	opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern|
 		options[:pattern] = pattern
 	end
 
-	opts.on('-w', '--wallet WALLET', I18n.t('option.wallet')) do |wallet|
+	opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
 		options[:wallet] = wallet
 	end
 end.parse!
diff --git a/bin/mpw-update b/bin/mpw-update
index e521ffc..cab7cbf 100644
--- a/bin/mpw-update
+++ b/bin/mpw-update
@@ -27,13 +27,13 @@ require 'mpw/cli'
 options = {}
 
 OptionParser.new do |opts|
-	opts.banner = "#{I18n.t('option.usage')}: mpw [options]"
+	opts.banner = "#{I18n.t('option.usage')}: mpw update [options]"
 
-	opts.on('-c', '--config CONFIG', I18n.t('option.config')) do |config|
+	opts.on('-c', '--config PATH', I18n.t('option.config')) do |config|
 		options[:config] = config
 	end
 
-	opts.on('-g', '--group GROUP', I18n.t('option.config')) do |group|
+	opts.on('-g', '--group NAME', I18n.t('option.group')) do |group|
 		options[:group] = group
 	end
 
@@ -42,11 +42,11 @@ OptionParser.new do |opts|
 		exit 0
 	end
 
-	opts.on('-p', '--pattern PATTERN', I18n.t('option.config')) do |pattern|
+	opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern|
 		options[:pattern] = pattern
 	end
 
-	opts.on('-w', '--wallet WALLET', I18n.t('option.wallet')) do |wallet|
+	opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
 		options[:wallet] = wallet
 	end
 end.parse!
diff --git a/bin/mpw-wallet b/bin/mpw-wallet
index c5fdc7a..7c52f1b 100644
--- a/bin/mpw-wallet
+++ b/bin/mpw-wallet
@@ -29,7 +29,7 @@ options = {}
 OptionParser.new do |opts|
 	opts.banner = "#{I18n.t('option.usage')}: mpw wallet [options]"
 
-	opts.on('-c', '--config CONFIG', I18n.t('option.config')) do |config|
+	opts.on('-c', '--config PATH', I18n.t('option.config')) do |config|
 		options[:config] = config
 	end
 
@@ -38,7 +38,7 @@ OptionParser.new do |opts|
 		exit 0
 	end
 
-	opts.on('-w', '--wallet WALLET', I18n.t('option.wallet')) do |wallet|
+	opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
 		options[:wallet] = wallet
 	end
 end.parse!
diff --git a/i18n/en.yml b/i18n/en.yml
index 7c7bcc5..b4d2b15 100644
--- a/i18n/en.yml
+++ b/i18n/en.yml
@@ -39,15 +39,21 @@ en:
     config: "Specify the configuration file to use"
     clipboard: "Disable the clipboard feature"
     export: "Export a wallet in an yaml file"
-    file: "Specify a file, to use with the options [--import | --export | --add]"
+    file_export: "Specify the file where export data"
+    file_import: "Specify the file to import"
     force: "No ask to confirm when you delete an item"
     generate_password: "Generate a random password (default 8 characters)"
+    gpg_exe: "Set the gpg binary path to use"
+    gpg_key: "Specify a GPG key (ex: user@example.com)"
     group: "Search the items with specified group"
     help: "Show this help message"
+    init: "Initialize mpw"
     import: "Import item since a yaml file"
-    key: "Specify the key name, to use with the options [--add | --delete | --update]"
+    key: "Specify the key name"
+    lang: "Set the software language"
     no_sync: "Disable synchronization with the server"
     numeric: "Use number to generate a password"
+    pattern: "Given search pattern"
     setup: "Create a new configuration file" 
     setup_wallet: "Create a new configuration file for a wallet"
     special_chars: "Use special char to generate a password"
@@ -55,6 +61,7 @@ en:
     show_all: "List all items"
     usage: "Usage"
     wallet: "Specify a wallet to use"
+    wallet_dir: "Set the wallets folder"
 
   form:
     select: "Select the item: "
diff --git a/i18n/fr.yml b/i18n/fr.yml
index a5d7aff..f7233af 100644
--- a/i18n/fr.yml
+++ b/i18n/fr.yml
@@ -39,15 +39,21 @@ fr:
     config: "Spécifie le fichier de configuration à utiliser"
     clipboard: "Désactive la fonction presse papier"
     export: "Exporte un portefeuille dans un fichier yaml"
-    file: "Spécifie un fichier, à utiliser avec les options [--import | --export | --add]"
+    file_export: "Spécifie le fichier où exporter les données"
+    file_import: "Spécifie le fichier à importer"
     force: "Ne demande pas de confirmation pour la suppression d'un élément"
     generate_password: "Génére un mot de passe aléatoire (défaut 8 caractères)"
+    gpg_exe: "Spécifie le chemin du binaire gpg à utiliser"
+    gpg_key: "Spécifie une clé GPG (ex: user@example.com)"
     group: "Recherche les éléments appartenant au groupe spécifié"
     help: "Affiche ce message d'aide"
     import: "Importe des éléments depuis un fichier yaml"
-    key: "Spécifie le nom d'une clé, à utiliser avec les options [--add | --delete | --update]"
+    init: "Initialise mpw"
+    key: "Spécifie le nom d'une clé"
+    lang: "Spécifie la langue du logiciel (ex: fr)"
     no_sync: "Désactive la synchronisation avec le serveur"
     numeric: "Utilise des chiffre dans la génération d'un mot de passe"
+    pattern: "Motif de donnée à chercher"
     setup: "Création d'un nouveau fichier de configuration"
     setup_wallet: "Création d'un nouveau fichier de configuration pour un portefeuille"
     special_chars: "Utilise des charactères speciaux dans la génération d'un mot de passe"
@@ -55,6 +61,7 @@ fr:
     show_all: "Liste tous les éléments"
     usage: "Utilisation"
     wallet: "Spécifie le portefeuille à utiliser"
+    wallet_dir: "Spécifie le répertoire des portefeuilles"
 
   form:
     select: "Sélectionner l'élément: "