bin/mellon in mellon-1.0.0 vs bin/mellon in mellon-1.1.0
- old
+ new
@@ -53,15 +53,36 @@
on :v, :version, "Show Mellon version." do
puts "Mellon v#{Mellon::VERSION}"
exit
end
- description "list globally known keychains."
+ description "list keychain entries."
command "list" do
+ banner "Usage: mellon list [options]"
+ define_common[self]
+
run do
- puts "Available keychains:"
- Mellon::Keychain.list.each do |keychain|
- puts " #{keychain.name}"
+ if $keychain.nil?
+ entries = {}
+ Mellon::Keychain.list.map do |keychain|
+ keys = keychain.keys
+ entries[keychain] = keys if keys.length > 0
+ end
+
+ if entries.empty?
+ puts "There are no keychains with entries."
+ else
+ puts entries.map { |keychain, entries|
+ joiner = "\n "
+ "#{keychain.path}:#{joiner}" << entries.join(joiner)
+ }.join("\n\n")
+ end
+ else
+ joiner = "\n "
+ keychain = $keychain
+ entries = keychain.keys
+
+ puts "#{keychain.path}:#{joiner}" << entries.join(joiner)
end
end
end
description "edit or create a keychain entry."