From 8e4fb1c91bf2701d8ded1a9ff9db36d0003d763a Mon Sep 17 00:00:00 2001 From: Adrien Waksberg Date: Thu, 18 May 2017 23:30:54 +0200 Subject: [PATCH] fix show config --- lib/mpw/cli.rb | 2 +- lib/mpw/config.rb | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/mpw/cli.rb b/lib/mpw/cli.rb index cc0ebf0..d794434 100644 --- a/lib/mpw/cli.rb +++ b/lib/mpw/cli.rb @@ -105,7 +105,7 @@ module MPW 'lang' => @config.lang, 'gpg_key' => @config.gpg_key, 'default_wallet' => @config.default_wallet, - 'config_dir' => @config.config_dir, + 'wallet_dir' => @config.wallet_dir, 'pinmode' => @config.pinmode, 'gpg_exe' => @config.gpg_exe } diff --git a/lib/mpw/config.rb b/lib/mpw/config.rb index bdcf394..016c690 100644 --- a/lib/mpw/config.rb +++ b/lib/mpw/config.rb @@ -58,11 +58,13 @@ module MPW wallet_dir = options[:wallet_dir] || @wallet_dir default_wallet = options[:default_wallet] || @default_wallet gpg_exe = options[:gpg_exe] || @gpg_exe - pinmode = options[:pinmode] || @pinmode - password = { numeric: true, - alpha: true, - special: false, - length: 16 } + pinmode = options.key?(:pinmode) ? options[:pinmode] : @pinmode + password = { + numeric: true, + alpha: true, + special: false, + length: 16 + } %w[numeric special alpha length].each do |k| if options.key?("pwd_#{k}".to_sym) @@ -134,7 +136,7 @@ module MPW @default_wallet = config['default_wallet'] @gpg_exe = config['gpg_exe'] @password = config['password'] || {} - @pinmode = config['pinmode'] + @pinmode = config['pinmode'] || false raise if @gpg_key.empty? || @wallet_dir.empty?