mirror of
https://github.com/nishiki/manage-password.git
synced 2024-11-27 07:33:05 +00:00
add option for choice the wallet
This commit is contained in:
parent
163ef46076
commit
afb197aff5
2 changed files with 8 additions and 3 deletions
7
bin/mpw
7
bin/mpw
|
@ -41,6 +41,7 @@ options[:format] = false
|
|||
options[:sync] = true
|
||||
options[:group] = nil
|
||||
options[:config] = nil
|
||||
options[:wallet] = nil
|
||||
|
||||
OptionParser.new do |opts|
|
||||
opts.banner = "#{I18n.t('option.usage')}: mpw [options]"
|
||||
|
@ -90,6 +91,10 @@ OptionParser.new do |opts|
|
|||
options[:sync] = false
|
||||
end
|
||||
|
||||
opts.on('-w', '--wallet WALLET', I18n.t('option.wallet')) do |wallet|
|
||||
options[:wallet] = wallet
|
||||
end
|
||||
|
||||
opts.on('-G', '--generate-password [LENGTH]', I18n.t('option.generate_password')) do |length|
|
||||
puts MPW::MPW::password(length)
|
||||
exit 0
|
||||
|
@ -108,7 +113,7 @@ end.parse!
|
|||
config = MPW::Config.new(options[:config])
|
||||
check_error = config.checkconfig
|
||||
|
||||
cli = Cli.new(config)
|
||||
cli = Cli.new(config, options[:wallet])
|
||||
|
||||
# Setup a new config
|
||||
if not check_error or not options[:setup].nil?
|
||||
|
|
|
@ -17,9 +17,9 @@ class Cli
|
|||
# @args: lang -> the operating system language
|
||||
# config_file -> a specify config file
|
||||
# TODO
|
||||
def initialize(config)
|
||||
def initialize(config, wallet)
|
||||
@config = config
|
||||
@wallet_file = "#{@config.wallet_dir}/test.mpw"
|
||||
@wallet_file = "#{@config.wallet_dir}/#{wallet}.mpw"
|
||||
end
|
||||
|
||||
# Create a new config file
|
||||
|
|
Loading…
Reference in a new issue