diff options
| author | mokha <mokha@cisco.com> | 2018-12-02 22:36:24 -0700 |
|---|---|---|
| committer | mokha <mokha@cisco.com> | 2018-12-02 22:36:24 -0700 |
| commit | 7974eeaa1e636538cb7e869c25fcd7d24862c442 (patch) | |
| tree | 72d68bda1f948c657416fc8c78d17592427656e8 | |
| parent | e3229bbc175455f0f4d059a41c53e3b5afeaf834 (diff) | |
use guard clausev0.0.16
Signed-off-by: mokha <mokha@cisco.com>
| -rw-r--r-- | lib/tfa/cli.rb | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/lib/tfa/cli.rb b/lib/tfa/cli.rb index 2f923a4..cc0169c 100644 --- a/lib/tfa/cli.rb +++ b/lib/tfa/cli.rb @@ -24,20 +24,17 @@ module TFA desc "show NAME", "shows the secret for the given key" method_option :format, default: "raw", enum: ["raw", "qrcode", "uri"], desc: "The format to export" def show(name = nil) - if name - secret = storage.secret_for(name) - case options[:format] - when "qrcode" - RQRCode::QRCode.new(uri_for(name, secret)).as_ansi( - light: "\033[47m", dark: "\033[40m", fill_character: ' ', quiet_zone_size: 1 - ) - when "uri" - uri_for(name, secret) - else - secret - end + return storage.all.map { |x| x.keys }.flatten.sort unless name + + case options[:format] + when "qrcode" + RQRCode::QRCode.new(uri_for(name, storage.secret_for(name))).as_ansi( + light: "\033[47m", dark: "\033[40m", fill_character: ' ', quiet_zone_size: 1 + ) + when "uri" + uri_for(name, storage.secret_for(name)) else - storage.all.map { |x| x.keys }.flatten.sort + storage.secret_for(name) end end |
