mirror of
https://github.com/nishiki/manage-password.git
synced 2024-11-26 23:33:03 +00:00
cli: add list gpg keys in wallet
This commit is contained in:
parent
ec3abbe88a
commit
362253c63b
4 changed files with 36 additions and 2 deletions
|
@ -54,10 +54,14 @@ OptionParser.new do |opts|
|
||||||
values[:host] = host
|
values[:host] = host
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-l', '--list', I18n.t('option.list')) do |list|
|
opts.on('-l', '--list', I18n.t('option.list')) do
|
||||||
options[:list] = true
|
options[:list] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
opts.on('-L', '--list-keys', I18n.t('option.list_keys')) do
|
||||||
|
options[:list_keys] = true
|
||||||
|
end
|
||||||
|
|
||||||
opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
|
opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
|
||||||
options[:sync] = false
|
options[:sync] = false
|
||||||
end
|
end
|
||||||
|
@ -98,7 +102,9 @@ else
|
||||||
cli.get_wallet(options[:wallet])
|
cli.get_wallet(options[:wallet])
|
||||||
cli.decrypt
|
cli.decrypt
|
||||||
|
|
||||||
if not options[:gpg_key].nil?
|
if not options[:list_keys].nil?
|
||||||
|
cli.list_keys
|
||||||
|
elsif not options[:gpg_key].nil?
|
||||||
if options[:delete]
|
if options[:delete]
|
||||||
cli.delete_key(options[:gpg_key])
|
cli.delete_key(options[:gpg_key])
|
||||||
else
|
else
|
||||||
|
|
|
@ -71,6 +71,7 @@ en:
|
||||||
lang: "Set the software language"
|
lang: "Set the software language"
|
||||||
length: "Size of the password"
|
length: "Size of the password"
|
||||||
list: "List the wallets"
|
list: "List the wallets"
|
||||||
|
list_keys: "List the GPG keys in wallet"
|
||||||
no_sync: "Disable synchronization with the server"
|
no_sync: "Disable synchronization with the server"
|
||||||
numeric: "Use number to generate a password"
|
numeric: "Use number to generate a password"
|
||||||
password: "Change the password for the synchronization"
|
password: "Change the password for the synchronization"
|
||||||
|
@ -173,6 +174,7 @@ en:
|
||||||
display:
|
display:
|
||||||
comment: "Comment"
|
comment: "Comment"
|
||||||
error: "ERROR"
|
error: "ERROR"
|
||||||
|
keys: "GPG keys"
|
||||||
gpg_password: "GPG passphrase: "
|
gpg_password: "GPG passphrase: "
|
||||||
group: "Group"
|
group: "Group"
|
||||||
login: "Login"
|
login: "Login"
|
||||||
|
|
|
@ -71,6 +71,7 @@ fr:
|
||||||
lang: "Spécifie la langue du logiciel (ex: fr)"
|
lang: "Spécifie la langue du logiciel (ex: fr)"
|
||||||
length: "Taille du mot de passe"
|
length: "Taille du mot de passe"
|
||||||
list: "Liste les portefeuilles"
|
list: "Liste les portefeuilles"
|
||||||
|
list_keys: "Liste les clés GPG dans le portefeuille"
|
||||||
no_sync: "Désactive la synchronisation avec le serveur"
|
no_sync: "Désactive la synchronisation avec le serveur"
|
||||||
numeric: "Utilise des chiffre dans la génération d'un mot de passe"
|
numeric: "Utilise des chiffre dans la génération d'un mot de passe"
|
||||||
password: "Changer le mot de passe de connexion"
|
password: "Changer le mot de passe de connexion"
|
||||||
|
@ -173,6 +174,7 @@ fr:
|
||||||
display:
|
display:
|
||||||
comment: "Commentaire"
|
comment: "Commentaire"
|
||||||
error: "ERREUR"
|
error: "ERREUR"
|
||||||
|
keys: "Clés GPG"
|
||||||
gpg_password: "Mot de passe GPG: "
|
gpg_password: "Mot de passe GPG: "
|
||||||
group: "Groupe"
|
group: "Groupe"
|
||||||
login: "Identifiant"
|
login: "Identifiant"
|
||||||
|
|
|
@ -112,6 +112,30 @@ class Cli
|
||||||
exit 2
|
exit 2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# List gpg keys in wallet
|
||||||
|
def list_keys
|
||||||
|
i = 1
|
||||||
|
length = 0
|
||||||
|
|
||||||
|
@mpw.list_keys.each do |key|
|
||||||
|
length = key.length if length < key.length
|
||||||
|
end
|
||||||
|
length += 7
|
||||||
|
|
||||||
|
puts "\n#{I18n.t('display.keys')}".red
|
||||||
|
length.times { print '=' }
|
||||||
|
print "\n"
|
||||||
|
|
||||||
|
@mpw.list_keys.each do |key|
|
||||||
|
print " #{i}".cyan
|
||||||
|
(3 - i.to_s.length).times { print ' ' }
|
||||||
|
puts "| #{key}"
|
||||||
|
i += 1
|
||||||
|
end
|
||||||
|
|
||||||
|
print "\n"
|
||||||
|
end
|
||||||
|
|
||||||
# Load config
|
# Load config
|
||||||
def load_config
|
def load_config
|
||||||
@config.load_config
|
@config.load_config
|
||||||
|
|
Loading…
Reference in a new issue