1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2025-02-20 01:50:04 +00:00

add class cli in module mpw

This commit is contained in:
nishiki 2016-05-07 15:05:14 +02:00
parent 812a02d60e
commit ad1713edcb
2 changed files with 5 additions and 3 deletions

View file

@ -124,7 +124,7 @@ end.parse!
config = MPW::Config.new(options[:config])
check_error = config.checkconfig
cli = Cli.new(config)
cli = MPW::Cli.new(config)
# Setup a new config
if not check_error or not options[:setup].nil?

View file

@ -11,6 +11,7 @@ require 'highline/import'
require "#{APP_ROOT}/../lib/mpw/item.rb"
require "#{APP_ROOT}/../lib/mpw/mpw.rb"
module MPW
class Cli
# Constructor
@ -88,7 +89,7 @@ class Cli
def decrypt
if not defined?(@mpw)
@password = ask(I18n.t('display.gpg_password')) {|q| q.echo = false}
@mpw = MPW::MPW.new(@config.key, @wallet_file, @password)
@mpw = MPW.new(@config.key, @wallet_file, @password)
end
@mpw.read_data
@ -208,7 +209,7 @@ class Cli
options[:port] = ask(I18n.t('form.add.port')).to_s
options[:comment] = ask(I18n.t('form.add.comment')).to_s
item = MPW::Item.new(options)
item = Item.new(options)
@mpw.add(item)
@mpw.set_password(item.id, password)
@ -299,3 +300,4 @@ class Cli
puts "#{I18n.t('display.error')} #18: #{e}".red
end
end
end