class SecretKeys::CLI::Read
Attributes
key[R]
Public Instance Methods
action_name()
click to toggle source
# File lib/secret_keys/cli.rb, line 250 def action_name "read" end
parse_additional_options(opts)
click to toggle source
# File lib/secret_keys/cli.rb, line 254 def parse_additional_options(opts) opts.separator("\n Read options:") @key = nil opts.on("-k", "--key KEY", String, "Key from the file to output. You can use dot notation to read a nested key.") do |value| @key = value end end
run!()
click to toggle source
# File lib/secret_keys/cli.rb, line 262 def run! raise ArgumentError.new("key is required") if @key.nil? || @key.empty? val = secrets.to_h val = access_key(val, @key) { |parent, key| parent[key] } $stdout.write(val) $stdout.flush end