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
|
||||
end
|
||||
|
||||
opts.on('-l', '--list', I18n.t('option.list')) do |list|
|
||||
opts.on('-l', '--list', I18n.t('option.list')) do
|
||||
options[:list] = true
|
||||
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
|
||||
options[:sync] = false
|
||||
end
|
||||
|
@ -98,7 +102,9 @@ else
|
|||
cli.get_wallet(options[:wallet])
|
||||
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]
|
||||
cli.delete_key(options[:gpg_key])
|
||||
else
|
||||
|
|
|
@ -71,6 +71,7 @@ en:
|
|||
lang: "Set the software language"
|
||||
length: "Size of the password"
|
||||
list: "List the wallets"
|
||||
list_keys: "List the GPG keys in wallet"
|
||||
no_sync: "Disable synchronization with the server"
|
||||
numeric: "Use number to generate a password"
|
||||
password: "Change the password for the synchronization"
|
||||
|
@ -173,6 +174,7 @@ en:
|
|||
display:
|
||||
comment: "Comment"
|
||||
error: "ERROR"
|
||||
keys: "GPG keys"
|
||||
gpg_password: "GPG passphrase: "
|
||||
group: "Group"
|
||||
login: "Login"
|
||||
|
|
|
@ -71,6 +71,7 @@ fr:
|
|||
lang: "Spécifie la langue du logiciel (ex: fr)"
|
||||
length: "Taille du mot de passe"
|
||||
list: "Liste les portefeuilles"
|
||||
list_keys: "Liste les clés GPG dans le portefeuille"
|
||||
no_sync: "Désactive la synchronisation avec le serveur"
|
||||
numeric: "Utilise des chiffre dans la génération d'un mot de passe"
|
||||
password: "Changer le mot de passe de connexion"
|
||||
|
@ -173,6 +174,7 @@ fr:
|
|||
display:
|
||||
comment: "Commentaire"
|
||||
error: "ERREUR"
|
||||
keys: "Clés GPG"
|
||||
gpg_password: "Mot de passe GPG: "
|
||||
group: "Groupe"
|
||||
login: "Identifiant"
|
||||
|
|
|
@ -112,6 +112,30 @@ class Cli
|
|||
exit 2
|
||||
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
|
||||
def load_config
|
||||
@config.load_config
|
||||
|
|
Loading…
Reference in a new issue