io.puts parser.summarize
io.puts "Decrypts the file, fetches a key and outputs it to stdout."
io.puts "The file must be in YAML format."
- io.puts "query is a query, formatted like host/users/root"
+ io.puts "query is a query, formatted like /host/users/root"
exit(code)
end
require 'pp'
- a = what.split("/")
+ a = what.split("/")[1..-1]
hit = yaml
+ if a.nil?
+ # q = /, so print top level keys
+ puts "Keys:"
+ hit.keys.each do |k|
+ puts "- #{k}"
+ end
+ return
+ end
a.each do |k|
hit = hit[k]
end
STDERR.puts("No such key or invalid lookup expression")
elsif hit.respond_to?(:keys)
puts "Keys:"
- puts hit.keys.join("\n")
+ hit.keys.each do |k|
+ puts "- #{k}"
+ end
else
puts hit
end