mirror of
https://github.com/nishiki/manage-password.git
synced 2024-11-23 13:57:52 +00:00
separate cli translate
This commit is contained in:
parent
445626c7a2
commit
1400cf7834
6 changed files with 334 additions and 388 deletions
121
i18n/cli/en.yml
Normal file
121
i18n/cli/en.yml
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
---
|
||||||
|
en:
|
||||||
|
error:
|
||||||
|
config:
|
||||||
|
write: "Can't write the config file!"
|
||||||
|
check: "Checkconfig failed!"
|
||||||
|
key_bad_format: "The key string isn't in good format!"
|
||||||
|
delete:
|
||||||
|
id_no_exist: "Can't delete the item %{id}, it doesn't exist!"
|
||||||
|
export:
|
||||||
|
write: "Can't export, unable to write in %{file}!"
|
||||||
|
gpg_file:
|
||||||
|
decrypt: "Can't decrypt file!"
|
||||||
|
encrypt: "Can't encrypt the GPG file!"
|
||||||
|
import:
|
||||||
|
bad_format: "Can't import, the file is badly formated!"
|
||||||
|
read: "Can't import, unable to read %{file}!"
|
||||||
|
update:
|
||||||
|
name_empty: "You must define a name!"
|
||||||
|
sync:
|
||||||
|
connection: "Connection fail!"
|
||||||
|
communication: "A communication problem with the server is appeared!"
|
||||||
|
no_data: "Nothing data!"
|
||||||
|
not_authorized: "You haven't the access to remote file!"
|
||||||
|
unknown: "An unknown error is occured!"
|
||||||
|
option:
|
||||||
|
usage: "Usage"
|
||||||
|
show: "Search and show the items"
|
||||||
|
show_all: "Show all items"
|
||||||
|
update: "Update an item"
|
||||||
|
remove: "Delete an item"
|
||||||
|
group: "Search the items with specified group"
|
||||||
|
add: "Add an item"
|
||||||
|
config: "Specify the configuration file to use"
|
||||||
|
setup: "Create a new configuration file"
|
||||||
|
protocol: "Select the items with the specified protocol"
|
||||||
|
export: "Export all items in a CSV file"
|
||||||
|
import: "Import item since a CSV file"
|
||||||
|
force: "Force an action"
|
||||||
|
format: "Change the display items format by an alternative format"
|
||||||
|
generate_password: "Generate a random password (default 8 characters)"
|
||||||
|
help: "Show this help message"
|
||||||
|
form:
|
||||||
|
add:
|
||||||
|
title: "Add a new item"
|
||||||
|
name: "Enter the name: "
|
||||||
|
group: "Enter the group (optional): "
|
||||||
|
server: "Enter the hostname or ip: "
|
||||||
|
protocol: "Enter the protocol of the connection (ssh, http, other): "
|
||||||
|
login: "Enter the login connection: "
|
||||||
|
password: "Enter the the password: "
|
||||||
|
port: "Enter the connection port (optional): "
|
||||||
|
comment: "Enter a comment (optional): "
|
||||||
|
valid: "Item has been added!"
|
||||||
|
delete:
|
||||||
|
ask: "Are you sure you want to remove the item %{id} ?"
|
||||||
|
valid: "The item %{id} has been removed!"
|
||||||
|
not_valid: "The item %{id} hasn't been removed, because it doesn't exist!"
|
||||||
|
import:
|
||||||
|
ask: "Are you sure you want to import this file %{file} ?"
|
||||||
|
valid: "The import is succesfull!"
|
||||||
|
not_valid: "No data to import!"
|
||||||
|
setup:
|
||||||
|
title: "Setup a new config file"
|
||||||
|
lang: "Choose your language (en, fr, ...): "
|
||||||
|
gpg_key: "Enter the GPG key: "
|
||||||
|
gpg_file: "Enter the path to encrypt file [default=%{home}/.mpw.gpg]: "
|
||||||
|
timeout: "Enter the timeout (in seconde) to GPG password [default=60]: "
|
||||||
|
valid: "The config file has been created!"
|
||||||
|
update:
|
||||||
|
title: "Update an item"
|
||||||
|
name: "Enter the name [%{name}]: "
|
||||||
|
group: "Enter the group [%{group}]: "
|
||||||
|
server: "Enter the hostname or ip [%{server}]: "
|
||||||
|
protocol: "Enter the protocol of the connection [%{protocol}]: "
|
||||||
|
login: "Enter the login connection [%{login}]: "
|
||||||
|
password: "Enter the the password: "
|
||||||
|
port: "Enter the connection port [%{port}]: "
|
||||||
|
comment: "Enter a comment [%{comment}]: "
|
||||||
|
valid: "Item has been updated!"
|
||||||
|
interactive:
|
||||||
|
ask_password: "Password GPG: "
|
||||||
|
bad_password: "Bad password!"
|
||||||
|
goodbye: "Goodbye!"
|
||||||
|
unknown_command: "Unknown command!"
|
||||||
|
option:
|
||||||
|
title: "Help"
|
||||||
|
show: "Search and show the results"
|
||||||
|
group: "Change the group for the search"
|
||||||
|
add: "Add an item"
|
||||||
|
update: "Update an item"
|
||||||
|
remove: "Remove an item"
|
||||||
|
help: "Show this message"
|
||||||
|
quit: "Quit the software"
|
||||||
|
display:
|
||||||
|
comment: "Comment"
|
||||||
|
error: "ERROR"
|
||||||
|
gpg_password: "Password GPG: "
|
||||||
|
group: "Group"
|
||||||
|
login: "Login"
|
||||||
|
name: "Name"
|
||||||
|
nothing: "Nothing result!"
|
||||||
|
password: "Password"
|
||||||
|
port: "Port"
|
||||||
|
protocol: "Protocol"
|
||||||
|
server: "Server"
|
||||||
|
ssh:
|
||||||
|
option:
|
||||||
|
usage: "Usage"
|
||||||
|
login: "Change the login"
|
||||||
|
server: "Change the host or the ip"
|
||||||
|
port: "Change the port"
|
||||||
|
help: "Show this help message"
|
||||||
|
display:
|
||||||
|
connect: "Connection to:"
|
||||||
|
nothing: "Nothing result!"
|
||||||
|
formats:
|
||||||
|
default: ! '%Y-%m-%d'
|
||||||
|
long: ! '%B %d, %Y'
|
||||||
|
short: ! '%b %d'
|
||||||
|
custom: ! '%A, %M %B, %Y @ %l:%M%P'
|
121
i18n/cli/fr.yml
Normal file
121
i18n/cli/fr.yml
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
---
|
||||||
|
fr:
|
||||||
|
error:
|
||||||
|
config:
|
||||||
|
write: "Impossible d'écrire le fichier de configuration!"
|
||||||
|
check: "Le fichier de configuration est invalide!"
|
||||||
|
key_bad_format: "La clé GPG est invalide!"
|
||||||
|
delete:
|
||||||
|
id_no_exist: "Impossible de supprimer l'élément %{id}, car il n'existe pas!"
|
||||||
|
export:
|
||||||
|
write: "Impossible d'exporter les données dans le fichier %{file}!"
|
||||||
|
gpg_file:
|
||||||
|
decrypt: "Impossible de déchiffrer le fichier GPG!"
|
||||||
|
encrypt: "Impossible de chiffrer le fichier GPG!"
|
||||||
|
import:
|
||||||
|
bad_format: "Impossible d'importer le fichier car son format est incorrect!"
|
||||||
|
read: "Impossible d'importer le fichier %{file}, car il n'est pas lisible!"
|
||||||
|
update:
|
||||||
|
name_empty: "Vous devez définir un nom!"
|
||||||
|
sync:
|
||||||
|
connection: "La connexion n'a pu être établie!"
|
||||||
|
communication: "Un problème de communication avec le serveur est apparu!"
|
||||||
|
no_data: "Aucune donnée!"
|
||||||
|
not_authorized: "Vous n'avez pas les autorisations d'accès au fichier distant!"
|
||||||
|
unknown: "Une erreur inconnue est survenue!"
|
||||||
|
option:
|
||||||
|
usage: "Utilisation"
|
||||||
|
show: "Recherche et affiche les éléments"
|
||||||
|
show_all: "Affiche tous les éléments"
|
||||||
|
update: "Met à jour un élément"
|
||||||
|
remove: "Supprime un élément"
|
||||||
|
group: "Recherche les éléments appartenant au groupe spécifié"
|
||||||
|
add: "Ajoute un élément"
|
||||||
|
config: "Spécifie le fichier de configuration à utiliser"
|
||||||
|
setup: "Création d'un nouveau fichier de configuration"
|
||||||
|
protocol: "Sélectionne les éléments ayant le protocole spécifié"
|
||||||
|
export: "Exporte tous les éléments dans un fichier au format CSV"
|
||||||
|
import: "Importe des éléments depuis un fichier au format CSV"
|
||||||
|
force: "Force une action, l'action ne demandera pas de confirmation"
|
||||||
|
format: "Change le format d'affichage des éléments par un alternatif"
|
||||||
|
generate_password: "Génére un mot de passe aléatoire (défaut 8 caractères)"
|
||||||
|
help: "Affiche ce message d'aide"
|
||||||
|
form:
|
||||||
|
add:
|
||||||
|
title: "Ajout d'un nouvel élément"
|
||||||
|
name: "Entrez le nom: "
|
||||||
|
group: "Entrez le groupe (optionnel): "
|
||||||
|
server: "Entrez the hostname or ip: "
|
||||||
|
protocol: "Entrez le protocole de connexion (ssh, http, other): "
|
||||||
|
login: "Entrez l'identifiant de connexion: "
|
||||||
|
password: "Entrez le mot de passe: "
|
||||||
|
port: "Entrez le port de connexion (optionnel): "
|
||||||
|
comment: "Entrez un commentaire (optionnel): "
|
||||||
|
valid: "L'élément a bien été ajouté!"
|
||||||
|
delete:
|
||||||
|
ask: "Êtes vous sûre de vouloir supprimer l'élément %{id} ?"
|
||||||
|
valid: "L'élément %{id} a bien été supprimé!"
|
||||||
|
not_valid: "L'élément %{id} n'a pu être supprimé, car il n'existe pas!"
|
||||||
|
import:
|
||||||
|
ask: "Êtes vous sûre de vouloir importer le fichier %{file} ?"
|
||||||
|
valid: "L'import est un succès!"
|
||||||
|
not_valid: "Aucune donnée à importer!"
|
||||||
|
setup:
|
||||||
|
title: "Création d'un nouveau fichier de configuration"
|
||||||
|
lang: "Choisissez votre langue (en, fr, ...) [défaut=%{lang}]: "
|
||||||
|
gpg_key: "Entrez la clé GPG: "
|
||||||
|
gpg_file: "Entrez le chemin du fichier qui sera chiffré [défaut=%{home}/.mpw.gpg]: "
|
||||||
|
timeout: "Entrez le temps (en seconde) du mot de passe GPG [défaut=60]: "
|
||||||
|
valid: "Le fichier de configuration a bien été créé!"
|
||||||
|
update:
|
||||||
|
title: "Mis à jour d'un élément"
|
||||||
|
name: "Entrez le nom [%{name}]: "
|
||||||
|
group: "Entrez le groupe [%{group}]: "
|
||||||
|
server: "Entrez le nom de domaine ou l'ip du serveur [%{server}]: "
|
||||||
|
protocol: "Entrez le protocole de connexion [%{protocol}]: "
|
||||||
|
login: "Entrez votre identifiant de connexion [%{login}]: "
|
||||||
|
password: "Entrez le mot de passe: "
|
||||||
|
port: "Entrez un port de connexion [%{port}]: "
|
||||||
|
comment: "Entrez un commentaire [%{comment}]: "
|
||||||
|
valid: "L'élément a bien été mis à jour!"
|
||||||
|
interactive:
|
||||||
|
ask_password: "Mot de passe GPG: "
|
||||||
|
bad_password: "Mauvais mot de passe!"
|
||||||
|
goodbye: "Au revoir!"
|
||||||
|
unknown_command: "Commande inconnue!"
|
||||||
|
option:
|
||||||
|
title: "Aide"
|
||||||
|
show: "Cherche et affiche les résulats"
|
||||||
|
group: "Change de groupe pour la recherche"
|
||||||
|
add: "Ajout un élément"
|
||||||
|
update: "Met à jour un élément"
|
||||||
|
remove: "Supprime un élément"
|
||||||
|
help: "Affiche ce message d'aide"
|
||||||
|
quit: "Quitte le programme"
|
||||||
|
display:
|
||||||
|
comment: "Commentaire"
|
||||||
|
error: "ERREUR"
|
||||||
|
gpg_password: "Mot de passe GPG: "
|
||||||
|
group: "Groupe"
|
||||||
|
login: "Identifiant"
|
||||||
|
name: "Nom"
|
||||||
|
nothing: "Aucun résultat!"
|
||||||
|
password: "Mot de passe"
|
||||||
|
port: "Port"
|
||||||
|
protocol: "Protocol"
|
||||||
|
server: "Serveur"
|
||||||
|
ssh:
|
||||||
|
option:
|
||||||
|
usage: "Utilisation"
|
||||||
|
login: "Change l'identifiant de connexion"
|
||||||
|
server: "Change le nom de domaine ou l'ip du serveur"
|
||||||
|
port: "Change le port de connexion"
|
||||||
|
help: "Affiche ce message d'aide"
|
||||||
|
display:
|
||||||
|
connect: "Connexion à:"
|
||||||
|
nothing: "Aucun résultat!"
|
||||||
|
formats:
|
||||||
|
default: ! '%Y-%m-%d'
|
||||||
|
long: ! '%B %d, %Y'
|
||||||
|
short: ! '%b %d'
|
||||||
|
custom: ! '%A, %M %B, %Y @ %l:%M%P'
|
148
i18n/en.yml
148
i18n/en.yml
|
@ -1,148 +0,0 @@
|
||||||
---
|
|
||||||
en:
|
|
||||||
error:
|
|
||||||
config:
|
|
||||||
write: "Can't write the config file!"
|
|
||||||
check: "Checkconfig failed!"
|
|
||||||
key_bad_format: "The key string isn't in good format!"
|
|
||||||
delete:
|
|
||||||
id_no_exist: "Can't delete the item %{id}, it doesn't exist!"
|
|
||||||
export:
|
|
||||||
write: "Can't export, unable to write in %{file}!"
|
|
||||||
gpg_file:
|
|
||||||
decrypt: "Can't decrypt file!"
|
|
||||||
encrypt: "Can't encrypt the GPG file!"
|
|
||||||
import:
|
|
||||||
bad_format: "Can't import, the file is badly formated!"
|
|
||||||
read: "Can't import, unable to read %{file}!"
|
|
||||||
update:
|
|
||||||
name_empty: "You must define a name!"
|
|
||||||
sync:
|
|
||||||
connection: "Connection fail!"
|
|
||||||
communication: "A communication problem with the server is appeared!"
|
|
||||||
no_data: "Nothing data!"
|
|
||||||
not_authorized: "You haven't the access to remote file!"
|
|
||||||
unknown: "An unknown error is occured!"
|
|
||||||
cli:
|
|
||||||
option:
|
|
||||||
usage: "Usage"
|
|
||||||
show: "Search and show the items"
|
|
||||||
show_all: "Show all items"
|
|
||||||
update: "Update an item"
|
|
||||||
remove: "Delete an item"
|
|
||||||
group: "Search the items with specified group"
|
|
||||||
add: "Add an item"
|
|
||||||
config: "Specify the configuration file to use"
|
|
||||||
setup: "Create a new configuration file"
|
|
||||||
protocol: "Select the items with the specified protocol"
|
|
||||||
export: "Export all items in a CSV file"
|
|
||||||
import: "Import item since a CSV file"
|
|
||||||
force: "Force an action"
|
|
||||||
format: "Change the display items format by an alternative format"
|
|
||||||
generate_password: "Generate a random password (default 8 characters)"
|
|
||||||
help: "Show this help message"
|
|
||||||
form:
|
|
||||||
add:
|
|
||||||
title: "Add a new item"
|
|
||||||
name: "Enter the name: "
|
|
||||||
group: "Enter the group (optional): "
|
|
||||||
server: "Enter the hostname or ip: "
|
|
||||||
protocol: "Enter the protocol of the connection (ssh, http, other): "
|
|
||||||
login: "Enter the login connection: "
|
|
||||||
password: "Enter the the password: "
|
|
||||||
port: "Enter the connection port (optional): "
|
|
||||||
comment: "Enter a comment (optional): "
|
|
||||||
valid: "Item has been added!"
|
|
||||||
delete:
|
|
||||||
ask: "Are you sure you want to remove the item %{id} ?"
|
|
||||||
valid: "The item %{id} has been removed!"
|
|
||||||
not_valid: "The item %{id} hasn't been removed, because it doesn't exist!"
|
|
||||||
import:
|
|
||||||
ask: "Are you sure you want to import this file %{file} ?"
|
|
||||||
valid: "The import is succesfull!"
|
|
||||||
not_valid: "No data to import!"
|
|
||||||
setup:
|
|
||||||
title: "Setup a new config file"
|
|
||||||
lang: "Choose your language (en, fr, ...): "
|
|
||||||
gpg_key: "Enter the GPG key: "
|
|
||||||
gpg_file: "Enter the path to encrypt file [default=%{home}/.mpw.gpg]: "
|
|
||||||
timeout: "Enter the timeout (in seconde) to GPG password [default=60]: "
|
|
||||||
valid: "The config file has been created!"
|
|
||||||
update:
|
|
||||||
title: "Update an item"
|
|
||||||
name: "Enter the name [%{name}]: "
|
|
||||||
group: "Enter the group [%{group}]: "
|
|
||||||
server: "Enter the hostname or ip [%{server}]: "
|
|
||||||
protocol: "Enter the protocol of the connection [%{protocol}]: "
|
|
||||||
login: "Enter the login connection [%{login}]: "
|
|
||||||
password: "Enter the the password: "
|
|
||||||
port: "Enter the connection port [%{port}]: "
|
|
||||||
comment: "Enter a comment [%{comment}]: "
|
|
||||||
valid: "Item has been updated!"
|
|
||||||
interactive:
|
|
||||||
ask_password: "Password GPG: "
|
|
||||||
bad_password: "Bad password!"
|
|
||||||
goodbye: "Goodbye!"
|
|
||||||
unknown_command: "Unknown command!"
|
|
||||||
option:
|
|
||||||
title: "Help"
|
|
||||||
show: "Search and show the results"
|
|
||||||
group: "Change the group for the search"
|
|
||||||
add: "Add an item"
|
|
||||||
update: "Update an item"
|
|
||||||
remove: "Remove an item"
|
|
||||||
help: "Show this message"
|
|
||||||
quit: "Quit the software"
|
|
||||||
display:
|
|
||||||
comment: "Comment"
|
|
||||||
error: "ERROR"
|
|
||||||
gpg_password: "Password GPG: "
|
|
||||||
group: "Group"
|
|
||||||
login: "Login"
|
|
||||||
name: "Name"
|
|
||||||
nothing: "Nothing result!"
|
|
||||||
password: "Password"
|
|
||||||
port: "Port"
|
|
||||||
protocol: "Protocol"
|
|
||||||
server: "Server"
|
|
||||||
sync:
|
|
||||||
not_connect: "The server connection fail!"
|
|
||||||
ssh:
|
|
||||||
option:
|
|
||||||
usage: "Usage"
|
|
||||||
login: "Change the login"
|
|
||||||
server: "Change the host or the ip"
|
|
||||||
port: "Change the port"
|
|
||||||
help: "Show this help message"
|
|
||||||
display:
|
|
||||||
connect: "Connection to:"
|
|
||||||
nothing: "Nothing result!"
|
|
||||||
server:
|
|
||||||
error:
|
|
||||||
client:
|
|
||||||
unknown: "An unknown error is appeared!"
|
|
||||||
no_authorized: "You haven't access to remote file!"
|
|
||||||
no_data: "Nothing data has been sent!"
|
|
||||||
option:
|
|
||||||
usage: "Usage"
|
|
||||||
config: "Specifie the configuration file"
|
|
||||||
checkconfig: "Check the configuration"
|
|
||||||
setup: "Setup a new configuration file"
|
|
||||||
help: "Show this message help"
|
|
||||||
checkconfig:
|
|
||||||
fail: "Checkconfig failed:!"
|
|
||||||
empty: "ERROR: an importe option is missing!"
|
|
||||||
datadir: "ERROR: le data directory doesn't exist!"
|
|
||||||
form:
|
|
||||||
setup:
|
|
||||||
title: "Serveur configuration"
|
|
||||||
host: "IP listen: "
|
|
||||||
port: "Port listen: "
|
|
||||||
data_dir: "Data directory: "
|
|
||||||
timeout: "Timeout to second: "
|
|
||||||
not_valid: "ERROR: Impossible to write the configuration file!"
|
|
||||||
formats:
|
|
||||||
default: ! '%Y-%m-%d'
|
|
||||||
long: ! '%B %d, %Y'
|
|
||||||
short: ! '%b %d'
|
|
||||||
custom: ! '%A, %M %B, %Y @ %l:%M%P'
|
|
148
i18n/fr.yml
148
i18n/fr.yml
|
@ -1,148 +0,0 @@
|
||||||
---
|
|
||||||
fr:
|
|
||||||
error:
|
|
||||||
config:
|
|
||||||
write: "Impossible d'écrire le fichier de configuration!"
|
|
||||||
check: "Le fichier de configuration est invalide!"
|
|
||||||
key_bad_format: "La clé GPG est invalide!"
|
|
||||||
delete:
|
|
||||||
id_no_exist: "Impossible de supprimer l'élément %{id}, car il n'existe pas!"
|
|
||||||
export:
|
|
||||||
write: "Impossible d'exporter les données dans le fichier %{file}!"
|
|
||||||
gpg_file:
|
|
||||||
decrypt: "Impossible de déchiffrer le fichier GPG!"
|
|
||||||
encrypt: "Impossible de chiffrer le fichier GPG!"
|
|
||||||
import:
|
|
||||||
bad_format: "Impossible d'importer le fichier car son format est incorrect!"
|
|
||||||
read: "Impossible d'importer le fichier %{file}, car il n'est pas lisible!"
|
|
||||||
update:
|
|
||||||
name_empty: "Vous devez définir un nom!"
|
|
||||||
sync:
|
|
||||||
connection: "La connexion n'a pu être établie!"
|
|
||||||
communication: "Un problème de communication avec le serveur est apparu!"
|
|
||||||
no_data: "Aucune donnée!"
|
|
||||||
not_authorized: "Vous n'avez pas les autorisations d'accès au fichier distant!"
|
|
||||||
unknown: "Une erreur inconnue est survenue!"
|
|
||||||
cli:
|
|
||||||
option:
|
|
||||||
usage: "Utilisation"
|
|
||||||
show: "Recherche et affiche les éléments"
|
|
||||||
show_all: "Affiche tous les éléments"
|
|
||||||
update: "Met à jour un élément"
|
|
||||||
remove: "Supprime un élément"
|
|
||||||
group: "Recherche les éléments appartenant au groupe spécifié"
|
|
||||||
add: "Ajoute un élément"
|
|
||||||
config: "Spécifie le fichier de configuration à utiliser"
|
|
||||||
setup: "Création d'un nouveau fichier de configuration"
|
|
||||||
protocol: "Sélectionne les éléments ayant le protocole spécifié"
|
|
||||||
export: "Exporte tous les éléments dans un fichier au format CSV"
|
|
||||||
import: "Importe des éléments depuis un fichier au format CSV"
|
|
||||||
force: "Force une action, l'action ne demandera pas de confirmation"
|
|
||||||
format: "Change le format d'affichage des éléments par un alternatif"
|
|
||||||
generate_password: "Génére un mot de passe aléatoire (défaut 8 caractères)"
|
|
||||||
help: "Affiche ce message d'aide"
|
|
||||||
form:
|
|
||||||
add:
|
|
||||||
title: "Ajout d'un nouvel élément"
|
|
||||||
name: "Entrez le nom: "
|
|
||||||
group: "Entrez le groupe (optionnel): "
|
|
||||||
server: "Entrez the hostname or ip: "
|
|
||||||
protocol: "Entrez le protocole de connexion (ssh, http, other): "
|
|
||||||
login: "Entrez l'identifiant de connexion: "
|
|
||||||
password: "Entrez le mot de passe: "
|
|
||||||
port: "Entrez le port de connexion (optionnel): "
|
|
||||||
comment: "Entrez un commentaire (optionnel): "
|
|
||||||
valid: "L'élément a bien été ajouté!"
|
|
||||||
delete:
|
|
||||||
ask: "Êtes vous sûre de vouloir supprimer l'élément %{id} ?"
|
|
||||||
valid: "L'élément %{id} a bien été supprimé!"
|
|
||||||
not_valid: "L'élément %{id} n'a pu être supprimé, car il n'existe pas!"
|
|
||||||
import:
|
|
||||||
ask: "Êtes vous sûre de vouloir importer le fichier %{file} ?"
|
|
||||||
valid: "L'import est un succès!"
|
|
||||||
not_valid: "Aucune donnée à importer!"
|
|
||||||
setup:
|
|
||||||
title: "Création d'un nouveau fichier de configuration"
|
|
||||||
lang: "Choisissez votre langue (en, fr, ...) [défaut=%{lang}]: "
|
|
||||||
gpg_key: "Entrez la clé GPG: "
|
|
||||||
gpg_file: "Entrez le chemin du fichier qui sera chiffré [défaut=%{home}/.mpw.gpg]: "
|
|
||||||
timeout: "Entrez le temps (en seconde) du mot de passe GPG [défaut=60]: "
|
|
||||||
valid: "Le fichier de configuration a bien été créé!"
|
|
||||||
update:
|
|
||||||
title: "Mis à jour d'un élément"
|
|
||||||
name: "Entrez le nom [%{name}]: "
|
|
||||||
group: "Entrez le groupe [%{group}]: "
|
|
||||||
server: "Entrez le nom de domaine ou l'ip du serveur [%{server}]: "
|
|
||||||
protocol: "Entrez le protocole de connexion [%{protocol}]: "
|
|
||||||
login: "Entrez votre identifiant de connexion [%{login}]: "
|
|
||||||
password: "Entrez le mot de passe: "
|
|
||||||
port: "Entrez un port de connexion [%{port}]: "
|
|
||||||
comment: "Entrez un commentaire [%{comment}]: "
|
|
||||||
valid: "L'élément a bien été mis à jour!"
|
|
||||||
interactive:
|
|
||||||
ask_password: "Mot de passe GPG: "
|
|
||||||
bad_password: "Mauvais mot de passe!"
|
|
||||||
goodbye: "Au revoir!"
|
|
||||||
unknown_command: "Commande inconnue!"
|
|
||||||
option:
|
|
||||||
title: "Aide"
|
|
||||||
show: "Cherche et affiche les résulats"
|
|
||||||
group: "Change de groupe pour la recherche"
|
|
||||||
add: "Ajout un élément"
|
|
||||||
update: "Met à jour un élément"
|
|
||||||
remove: "Supprime un élément"
|
|
||||||
help: "Affiche ce message d'aide"
|
|
||||||
quit: "Quitte le programme"
|
|
||||||
display:
|
|
||||||
comment: "Commentaire"
|
|
||||||
error: "ERREUR"
|
|
||||||
gpg_password: "Mot de passe GPG: "
|
|
||||||
group: "Groupe"
|
|
||||||
login: "Identifiant"
|
|
||||||
name: "Nom"
|
|
||||||
nothing: "Aucun résultat!"
|
|
||||||
password: "Mot de passe"
|
|
||||||
port: "Port"
|
|
||||||
protocol: "Protocol"
|
|
||||||
server: "Serveur"
|
|
||||||
sync:
|
|
||||||
not_connect: "La connexion au serveur n'a pu être établie!"
|
|
||||||
ssh:
|
|
||||||
option:
|
|
||||||
usage: "Utilisation"
|
|
||||||
login: "Change l'identifiant de connexion"
|
|
||||||
server: "Change le nom de domaine ou l'ip du serveur"
|
|
||||||
port: "Change le port de connexion"
|
|
||||||
help: "Affiche ce message d'aide"
|
|
||||||
display:
|
|
||||||
connect: "Connexion à:"
|
|
||||||
nothing: "Aucun résultat!"
|
|
||||||
server:
|
|
||||||
error:
|
|
||||||
client:
|
|
||||||
unknown: "Une erreur inconnue est apparue!"
|
|
||||||
no_authorized: "Vous n'avez pas les accès au fichier distant!"
|
|
||||||
no_data: "Aucune donnée n'a été transmise!"
|
|
||||||
option:
|
|
||||||
usage: "Utilisation"
|
|
||||||
config: "Spécifie le fichier de configuration"
|
|
||||||
checkconfig: "Vérifie le fichier de configuration"
|
|
||||||
setup: "Permet de générer un nouveau fichier de configuration"
|
|
||||||
help: "Affiche ce message d'aide"
|
|
||||||
checkconfig:
|
|
||||||
fail: "Le fichier de configuration est invalide!"
|
|
||||||
empty: "ERREUR: Une option importante est manquante!"
|
|
||||||
datadir: "ERREUR: Le répertoire des données n'existe pas!"
|
|
||||||
form:
|
|
||||||
setup:
|
|
||||||
title: "Configuration du serveur"
|
|
||||||
host: "IP d'écoute: "
|
|
||||||
port: "Port d'écoute: "
|
|
||||||
data_dir: "Répertoire des données: "
|
|
||||||
timeout: "Timeout en seconde: "
|
|
||||||
not_valid: "ERREUR: Impossible d'écire le fichier de configuration!"
|
|
||||||
formats:
|
|
||||||
default: ! '%Y-%m-%d'
|
|
||||||
long: ! '%B %d, %Y'
|
|
||||||
short: ! '%b %d'
|
|
||||||
custom: ! '%A, %M %B, %Y @ %l:%M%P'
|
|
150
lib/Cli.rb
150
lib/Cli.rb
|
@ -36,40 +36,40 @@ class Cli
|
||||||
if @config.sync_host.nil? || @config.sync_port.nil?
|
if @config.sync_host.nil? || @config.sync_port.nil?
|
||||||
@sync.disable()
|
@sync.disable()
|
||||||
elsif !@sync.connect(@config.sync_host, @config.sync_port, @config.key, @config.sync_pwd, @config.sync_suffix)
|
elsif !@sync.connect(@config.sync_host, @config.sync_port, @config.key, @config.sync_pwd, @config.sync_suffix)
|
||||||
puts "#{I18n.t('cli.sync.not_connect')}:\n#{@sync.error_msg}"
|
puts "#{I18n.t('sync.not_connect')}:\n#{@sync.error_msg}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if !@mpw.sync(@sync.get(@passwd), @config.last_update)
|
if !@mpw.sync(@sync.get(@passwd), @config.last_update)
|
||||||
puts "#{I18n.t('cli.display.error')}: #{@mpw.error_msg}"
|
puts "#{I18n.t('display.error')}: #{@mpw.error_msg}"
|
||||||
end
|
end
|
||||||
|
|
||||||
if !@sync.update(File.open(@config.file_gpg).read)
|
if !@sync.update(File.open(@config.file_gpg).read)
|
||||||
puts "#{I18n.t('cli.display.error')}: #{@sync.error_msg}"
|
puts "#{I18n.t('display.error')}: #{@sync.error_msg}"
|
||||||
end
|
end
|
||||||
|
|
||||||
if !@config.setLastUpdate()
|
if !@config.setLastUpdate()
|
||||||
puts "#{I18n.t('cli.display.error')}: #{@config.error_msg}"
|
puts "#{I18n.t('display.error')}: #{@config.error_msg}"
|
||||||
end
|
end
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts "#{I18n.t('cli.sync.error')}:\n#{e}"
|
puts "#{I18n.t('sync.error')}:\n#{e}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Create a new config file
|
# Create a new config file
|
||||||
# @args: lang -> the software language
|
# @args: lang -> the software language
|
||||||
def setup(lang)
|
def setup(lang)
|
||||||
puts I18n.t('cli.form.setup.title')
|
puts I18n.t('form.setup.title')
|
||||||
puts '--------------------'
|
puts '--------------------'
|
||||||
language = ask(I18n.t('cli.form.setup.lang', :lang => lang)).to_s
|
language = ask(I18n.t('form.setup.lang', :lang => lang)).to_s
|
||||||
key = ask(I18n.t('cli.form.setup.gpg_key')).to_s
|
key = ask(I18n.t('form.setup.gpg_key')).to_s
|
||||||
file_gpg = ask(I18n.t('cli.form.setup.gpg_file', :home => Dir.home())).to_s
|
file_gpg = ask(I18n.t('form.setup.gpg_file', :home => Dir.home())).to_s
|
||||||
timeout_pwd = ask(I18n.t('cli.form.setup.timeout')).to_s
|
timeout_pwd = ask(I18n.t('form.setup.timeout')).to_s
|
||||||
sync_host = ask(I18n.t('cli.form.setup.sync_host')).to_s
|
sync_host = ask(I18n.t('form.setup.sync_host')).to_s
|
||||||
sync_port = ask(I18n.t('cli.form.setup.sync_port')).to_s
|
sync_port = ask(I18n.t('form.setup.sync_port')).to_s
|
||||||
sync_pwd = ask(I18n.t('cli.form.setup.sync_pwd')).to_s
|
sync_pwd = ask(I18n.t('form.setup.sync_pwd')).to_s
|
||||||
sync_suffix = ask(I18n.t('cli.form.setup.sync_suffix')).to_s
|
sync_suffix = ask(I18n.t('form.setup.sync_suffix')).to_s
|
||||||
|
|
||||||
if !File.exist?("#{APP_ROOT}/i18n/#{language}.yml")
|
if !File.exist?("#{APP_ROOT}/i18n/#{language}.yml")
|
||||||
language= 'en'
|
language= 'en'
|
||||||
|
@ -82,13 +82,13 @@ class Cli
|
||||||
sync_suffix.empty? ? (sync_suffix = nil) : (sync_suffix = sync_suffix)
|
sync_suffix.empty? ? (sync_suffix = nil) : (sync_suffix = sync_suffix)
|
||||||
|
|
||||||
if @config.setup(key, language, file_gpg, timeout_pwd, sync_host, sync_port, sync_pwd, sync_suffix)
|
if @config.setup(key, language, file_gpg, timeout_pwd, sync_host, sync_port, sync_pwd, sync_suffix)
|
||||||
puts I18n.t('cli.form.setup.valid')
|
puts I18n.t('form.setup.valid')
|
||||||
else
|
else
|
||||||
puts "#{I18n.t('cli.display.error')}: #{@config.error_msg}"
|
puts "#{I18n.t('display.error')}: #{@config.error_msg}"
|
||||||
end
|
end
|
||||||
|
|
||||||
if not @config.checkconfig()
|
if not @config.checkconfig()
|
||||||
puts "#{I18n.t('cli.display.error')}: #{@config.error_msg}"
|
puts "#{I18n.t('display.error')}: #{@config.error_msg}"
|
||||||
exit 2
|
exit 2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -99,9 +99,9 @@ class Cli
|
||||||
@mpw = MPW.new(@config.file_gpg, @config.key)
|
@mpw = MPW.new(@config.file_gpg, @config.key)
|
||||||
end
|
end
|
||||||
|
|
||||||
@passwd = ask(I18n.t('cli.display.gpg_password')) {|q| q.echo = false}
|
@passwd = ask(I18n.t('display.gpg_password')) {|q| q.echo = false}
|
||||||
if !@mpw.decrypt(@passwd)
|
if !@mpw.decrypt(@passwd)
|
||||||
puts "#{I18n.t('cli.display.error')}: #{@mpw.error_msg}"
|
puts "#{I18n.t('display.error')}: #{@mpw.error_msg}"
|
||||||
exit 2
|
exit 2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -121,7 +121,7 @@ class Cli
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
puts I18n.t('cli.display.nothing')
|
puts I18n.t('display.nothing')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -130,14 +130,14 @@ class Cli
|
||||||
def displayFormat(item)
|
def displayFormat(item)
|
||||||
puts '--------------------'
|
puts '--------------------'
|
||||||
puts "Id: #{item[MPW::ID]}"
|
puts "Id: #{item[MPW::ID]}"
|
||||||
puts "#{I18n.t('cli.display.name')}: #{item[MPW::NAME]}"
|
puts "#{I18n.t('display.name')}: #{item[MPW::NAME]}"
|
||||||
puts "#{I18n.t('cli.display.group')}: #{item[MPW::GROUP]}"
|
puts "#{I18n.t('display.group')}: #{item[MPW::GROUP]}"
|
||||||
puts "#{I18n.t('cli.display.server')}: #{item[MPW::SERVER]}"
|
puts "#{I18n.t('display.server')}: #{item[MPW::SERVER]}"
|
||||||
puts "#{I18n.t('cli.display.protocol')}: #{item[MPW::PROTOCOL]}"
|
puts "#{I18n.t('display.protocol')}: #{item[MPW::PROTOCOL]}"
|
||||||
puts "#{I18n.t('cli.display.login')}: #{item[MPW::LOGIN]}"
|
puts "#{I18n.t('display.login')}: #{item[MPW::LOGIN]}"
|
||||||
puts "#{I18n.t('cli.display.password')}: #{item[MPW::PASSWORD]}"
|
puts "#{I18n.t('display.password')}: #{item[MPW::PASSWORD]}"
|
||||||
puts "#{I18n.t('cli.display.port')}: #{item[MPW::PORT]}"
|
puts "#{I18n.t('display.port')}: #{item[MPW::PORT]}"
|
||||||
puts "#{I18n.t('cli.display.comment')}: #{item[MPW::COMMENT]}"
|
puts "#{I18n.t('display.comment')}: #{item[MPW::COMMENT]}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Display an item in the alternative format
|
# Display an item in the alternative format
|
||||||
|
@ -159,26 +159,26 @@ class Cli
|
||||||
# Form to add a new item
|
# Form to add a new item
|
||||||
def add()
|
def add()
|
||||||
row = Array.new()
|
row = Array.new()
|
||||||
puts I18n.t('cli.form.add.title')
|
puts I18n.t('form.add.title')
|
||||||
puts '--------------------'
|
puts '--------------------'
|
||||||
name = ask(I18n.t('cli.form.add.name')).to_s
|
name = ask(I18n.t('form.add.name')).to_s
|
||||||
group = ask(I18n.t('cli.form.add.group')).to_s
|
group = ask(I18n.t('form.add.group')).to_s
|
||||||
server = ask(I18n.t('cli.form.add.server')).to_s
|
server = ask(I18n.t('form.add.server')).to_s
|
||||||
protocol = ask(I18n.t('cli.form.add.protocol')).to_s
|
protocol = ask(I18n.t('form.add.protocol')).to_s
|
||||||
login = ask(I18n.t('cli.form.add.login')).to_s
|
login = ask(I18n.t('form.add.login')).to_s
|
||||||
passwd = ask(I18n.t('cli.form.add.password')).to_s
|
passwd = ask(I18n.t('form.add.password')).to_s
|
||||||
port = ask(I18n.t('cli.form.add.port')).to_s
|
port = ask(I18n.t('form.add.port')).to_s
|
||||||
comment = ask(I18n.t('cli.form.add.comment')).to_s
|
comment = ask(I18n.t('form.add.comment')).to_s
|
||||||
|
|
||||||
if @mpw.update(name, group, server, protocol, login, passwd, port, comment)
|
if @mpw.update(name, group, server, protocol, login, passwd, port, comment)
|
||||||
if @mpw.encrypt()
|
if @mpw.encrypt()
|
||||||
sync()
|
sync()
|
||||||
puts I18n.t('cli.form.add.valid')
|
puts I18n.t('form.add.valid')
|
||||||
else
|
else
|
||||||
puts "#{I18n.t('cli.display.error')}: #{@mpw.error_msg}"
|
puts "#{I18n.t('display.error')}: #{@mpw.error_msg}"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
puts "#{I18n.t('cli.display.error')}: #{@mpw.error_msg}"
|
puts "#{I18n.t('display.error')}: #{@mpw.error_msg}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -188,29 +188,29 @@ class Cli
|
||||||
row = @mpw.searchById(id)
|
row = @mpw.searchById(id)
|
||||||
|
|
||||||
if not row.empty?
|
if not row.empty?
|
||||||
puts I18n.t('cli.form.update.title')
|
puts I18n.t('form.update.title')
|
||||||
puts '--------------------'
|
puts '--------------------'
|
||||||
name = ask(I18n.t('cli.form.update.name' , :name => row[MPW::NAME])).to_s
|
name = ask(I18n.t('form.update.name' , :name => row[MPW::NAME])).to_s
|
||||||
group = ask(I18n.t('cli.form.update.group' , :group => row[MPW::GROUP])).to_s
|
group = ask(I18n.t('form.update.group' , :group => row[MPW::GROUP])).to_s
|
||||||
server = ask(I18n.t('cli.form.update.server' , :server => row[MPW::SERVER])).to_s
|
server = ask(I18n.t('form.update.server' , :server => row[MPW::SERVER])).to_s
|
||||||
protocol = ask(I18n.t('cli.form.update.protocol', :protocol => row[MPW::PROTOCOL])).to_s
|
protocol = ask(I18n.t('form.update.protocol', :protocol => row[MPW::PROTOCOL])).to_s
|
||||||
login = ask(I18n.t('cli.form.update.login' , :login => row[MPW::LOGIN])).to_s
|
login = ask(I18n.t('form.update.login' , :login => row[MPW::LOGIN])).to_s
|
||||||
passwd = ask(I18n.t('cli.form.update.password')).to_s
|
passwd = ask(I18n.t('form.update.password')).to_s
|
||||||
port = ask(I18n.t('cli.form.update.port' , :port => row[MPW::PORT])).to_s
|
port = ask(I18n.t('form.update.port' , :port => row[MPW::PORT])).to_s
|
||||||
comment = ask(I18n.t('cli.form.update.comment' , :comment => row[MPW::COMMENT])).to_s
|
comment = ask(I18n.t('form.update.comment' , :comment => row[MPW::COMMENT])).to_s
|
||||||
|
|
||||||
if @mpw.update(name, group, server, protocol, login, passwd, port, comment, id)
|
if @mpw.update(name, group, server, protocol, login, passwd, port, comment, id)
|
||||||
if @mpw.encrypt()
|
if @mpw.encrypt()
|
||||||
sync()
|
sync()
|
||||||
puts I18n.t('cli.form.update.valid')
|
puts I18n.t('form.update.valid')
|
||||||
else
|
else
|
||||||
puts "#{I18n.t('cli.display.error')}: #{@mpw.error_msg}"
|
puts "#{I18n.t('display.error')}: #{@mpw.error_msg}"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
puts "#{I18n.t('cli.display.error')}: #{@mpw.error_msg}"
|
puts "#{I18n.t('display.error')}: #{@mpw.error_msg}"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
puts I18n.t('cli.display.nothing')
|
puts I18n.t('display.nothing')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -224,12 +224,12 @@ class Cli
|
||||||
if result.length > 0
|
if result.length > 0
|
||||||
displayFormat(result)
|
displayFormat(result)
|
||||||
|
|
||||||
confirm = ask("#{I18n.t('cli.form.delete.ask', :id => id)} (y/N) ").to_s
|
confirm = ask("#{I18n.t('form.delete.ask', :id => id)} (y/N) ").to_s
|
||||||
if confirm =~ /^(y|yes|YES|Yes|Y)$/
|
if confirm =~ /^(y|yes|YES|Yes|Y)$/
|
||||||
force = true
|
force = true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
puts I18n.t('cli.display.nothing')
|
puts I18n.t('display.nothing')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -237,12 +237,12 @@ class Cli
|
||||||
if @mpw.remove(id)
|
if @mpw.remove(id)
|
||||||
if @mpw.encrypt()
|
if @mpw.encrypt()
|
||||||
sync()
|
sync()
|
||||||
puts I18n.t('cli.form.delete.valid', :id => id)
|
puts I18n.t('form.delete.valid', :id => id)
|
||||||
else
|
else
|
||||||
puts "#{I18n.t('cli.display.error')}: #{@mpw.error_msg}"
|
puts "#{I18n.t('display.error')}: #{@mpw.error_msg}"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
puts I18n.t('cli.form.delete.not_valid')
|
puts I18n.t('form.delete.not_valid')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -253,7 +253,7 @@ class Cli
|
||||||
if @mpw.export(file)
|
if @mpw.export(file)
|
||||||
puts "The export in #{file} is succesfull!"
|
puts "The export in #{file} is succesfull!"
|
||||||
else
|
else
|
||||||
puts "#{I18n.t('cli.display.error')}: #{@mpw.error_msg}"
|
puts "#{I18n.t('display.error')}: #{@mpw.error_msg}"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -270,21 +270,21 @@ class Cli
|
||||||
displayFormat(r)
|
displayFormat(r)
|
||||||
end
|
end
|
||||||
|
|
||||||
confirm = ask("#{I18n.t('cli.form.import.ask', :file => file)} (y/N) ").to_s
|
confirm = ask("#{I18n.t('form.import.ask', :file => file)} (y/N) ").to_s
|
||||||
if confirm =~ /^(y|yes|YES|Yes|Y)$/
|
if confirm =~ /^(y|yes|YES|Yes|Y)$/
|
||||||
force = true
|
force = true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
puts I18n.t('cli.form.import.not_valid')
|
puts I18n.t('form.import.not_valid')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if force
|
if force
|
||||||
if @mpw.import(file) && @mpw.encrypt()
|
if @mpw.import(file) && @mpw.encrypt()
|
||||||
sync()
|
sync()
|
||||||
puts I18n.t('cli.form.import.valid')
|
puts I18n.t('form.import.valid')
|
||||||
else
|
else
|
||||||
puts "#{I18n.t('cli.display.error')}: #{@mpw.error_msg}"
|
puts "#{I18n.t('display.error')}: #{@mpw.error_msg}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -297,12 +297,12 @@ class Cli
|
||||||
while buf = Readline.readline('<mpw> ', true)
|
while buf = Readline.readline('<mpw> ', true)
|
||||||
|
|
||||||
if @config.timeout_pwd < Time.now.to_i - last_access
|
if @config.timeout_pwd < Time.now.to_i - last_access
|
||||||
passwd_confirm = ask(I18n.t('cli.interactive.ask_password')) {|q| q.echo = false}
|
passwd_confirm = ask(I18n.t('interactive.ask_password')) {|q| q.echo = false}
|
||||||
|
|
||||||
if @passwd.eql?(passwd_confirm)
|
if @passwd.eql?(passwd_confirm)
|
||||||
last_access = Time.now.to_i
|
last_access = Time.now.to_i
|
||||||
else
|
else
|
||||||
puts I18n.t('cli.interactive.bad_password')
|
puts I18n.t('interactive.bad_password')
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -333,21 +333,21 @@ class Cli
|
||||||
group = nil
|
group = nil
|
||||||
end
|
end
|
||||||
when 'help', 'h', '?'
|
when 'help', 'h', '?'
|
||||||
puts I18n.t('cli.interactive.option.title')
|
puts I18n.t('interactive.option.title')
|
||||||
puts '--------------------'
|
puts '--------------------'
|
||||||
puts "display, show, d, s SEARCH #{I18n.t('cli.interactive.option.show')}"
|
puts "display, show, d, s SEARCH #{I18n.t('interactive.option.show')}"
|
||||||
puts "group, g #{I18n.t('cli.interactive.option.group')}"
|
puts "group, g #{I18n.t('interactive.option.group')}"
|
||||||
puts "add, a #{I18n.t('cli.interactive.option.add')}"
|
puts "add, a #{I18n.t('interactive.option.add')}"
|
||||||
puts "update, u ID #{I18n.t('cli.interactive.option.update')}"
|
puts "update, u ID #{I18n.t('interactive.option.update')}"
|
||||||
puts "remove, delete, r, d ID #{I18n.t('cli.interactive.option.remove')}"
|
puts "remove, delete, r, d ID #{I18n.t('interactive.option.remove')}"
|
||||||
puts "help, h, ? #{I18n.t('cli.interactive.option.help')}"
|
puts "help, h, ? #{I18n.t('interactive.option.help')}"
|
||||||
puts "quit, exit, q #{I18n.t('cli.interactive.option.quit')}"
|
puts "quit, exit, q #{I18n.t('interactive.option.quit')}"
|
||||||
when 'quit', 'exit', 'q'
|
when 'quit', 'exit', 'q'
|
||||||
puts I18n.t('cli.interactive.goodbye')
|
puts I18n.t('interactive.goodbye')
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
if !command[0].nil? && !command[0].empty?
|
if !command[0].nil? && !command[0].empty?
|
||||||
puts I18n.t('cli.interactive.unknown_command')
|
puts I18n.t('interactive.unknown_command')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
34
mpw
34
mpw
|
@ -16,7 +16,7 @@ require "#{APP_ROOT}/lib/MPW.rb"
|
||||||
lang = Locale::Tag.parse(ENV['LANG']).to_simple.to_s[0..1]
|
lang = Locale::Tag.parse(ENV['LANG']).to_simple.to_s[0..1]
|
||||||
|
|
||||||
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
|
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
|
||||||
I18n.load_path = Dir["#{APP_ROOT}/i18n/*.yml"]
|
I18n.load_path = Dir["#{APP_ROOT}/i18n/cli/*.yml"]
|
||||||
I18n.default_locale = :en
|
I18n.default_locale = :en
|
||||||
I18n.locale = lang.to_sym
|
I18n.locale = lang.to_sym
|
||||||
|
|
||||||
|
@ -27,67 +27,67 @@ options[:group] = nil
|
||||||
options[:config] = nil
|
options[:config] = nil
|
||||||
|
|
||||||
OptionParser.new do |opts|
|
OptionParser.new do |opts|
|
||||||
opts.banner = "#{I18n.t('cli.option.usage')}: mpw [options]"
|
opts.banner = "#{I18n.t('option.usage')}: mpw [options]"
|
||||||
|
|
||||||
opts.on('-d', '--display [SEARCH]', I18n.t('cli.option.show')) do |search|
|
opts.on('-d', '--display [SEARCH]', I18n.t('option.show')) do |search|
|
||||||
search.nil? ? (options[:display] = '') : (options[:display] = search)
|
search.nil? ? (options[:display] = '') : (options[:display] = search)
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-A', '--show-all', I18n.t('cli.option.show_all')) do
|
opts.on('-A', '--show-all', I18n.t('option.show_all')) do
|
||||||
options[:type] = nil
|
options[:type] = nil
|
||||||
options[:display] = ''
|
options[:display] = ''
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-u', '--update ID', I18n.t('cli.option.update')) do |id|
|
opts.on('-u', '--update ID', I18n.t('option.update')) do |id|
|
||||||
options[:update] = id
|
options[:update] = id
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-r', '--remove ID', I18n.t('cli.option.remove')) do |id|
|
opts.on('-r', '--remove ID', I18n.t('option.remove')) do |id|
|
||||||
options[:remove] = id
|
options[:remove] = id
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-g', '--group GROUP', I18n.t('cli.option.group')) do |group|
|
opts.on('-g', '--group GROUP', I18n.t('option.group')) do |group|
|
||||||
options[:group] = group
|
options[:group] = group
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-a', '--add', I18n.t('cli.option.add')) do
|
opts.on('-a', '--add', I18n.t('option.add')) do
|
||||||
options[:add] = true
|
options[:add] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-c', '--config CONFIG', I18n.t('cli.option.config')) do |config|
|
opts.on('-c', '--config CONFIG', I18n.t('option.config')) do |config|
|
||||||
options[:config] = config
|
options[:config] = config
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-S', '--setup', I18n.t('cli.option.setup')) do
|
opts.on('-S', '--setup', I18n.t('option.setup')) do
|
||||||
options[:setup] = true
|
options[:setup] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-p', '--protocol PROTOCOL', I18n.t('cli.option.protocol')) do |type|
|
opts.on('-p', '--protocol PROTOCOL', I18n.t('option.protocol')) do |type|
|
||||||
options[:type] = type
|
options[:type] = type
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-e', '--export FILE', I18n.t('cli.option.export')) do |file|
|
opts.on('-e', '--export FILE', I18n.t('option.export')) do |file|
|
||||||
options[:export] = file
|
options[:export] = file
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-i', '--import FILE', I18n.t('cli.option.import')) do |file|
|
opts.on('-i', '--import FILE', I18n.t('option.import')) do |file|
|
||||||
options[:import] = file
|
options[:import] = file
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-f', '--force', I18n.t('cli.option.force')) do
|
opts.on('-f', '--force', I18n.t('option.force')) do
|
||||||
options[:force] = true
|
options[:force] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-F', '--format', I18n.t('cli.option.format')) do
|
opts.on('-F', '--format', I18n.t('option.format')) do
|
||||||
options[:format] = true
|
options[:format] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-G', '--generate-password [LENGTH]', I18n.t('cli.option.generate_password')) do |length|
|
opts.on('-G', '--generate-password [LENGTH]', I18n.t('option.generate_password')) do |length|
|
||||||
puts MPW::generatePassword(length)
|
puts MPW::generatePassword(length)
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-h', '--help', I18n.t('cli.option.help')) do
|
opts.on('-h', '--help', I18n.t('option.help')) do
|
||||||
puts opts
|
puts opts
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue