lib/universa_tools/uniring.rb in universa_tools-0.1.4 vs lib/universa_tools/uniring.rb in universa_tools-0.1.5
- old
+ new
@@ -56,13 +56,13 @@
#{sample "uniring help"}
End
opts.separator ""
- opts.on("--term-with SIZE", "set terminal width to specified size when formatting output, default is taken from the terminal and is currently #@term_width.") { |size|
- @term_width = size
- }
+ # opts.on("--term-with SIZE", "override terminal width to specified size when formatting output, default is taken from the terminal and is currently #@term_width.") { |size|
+ # @term_width = size
+ # }
opts.on("--all", "allow delete/update more than one key at a time") {
@allow_all = true
}
@@ -109,17 +109,30 @@
opts.on("-l", "--list", "show keys in a ring") {
task {
keyring # this may ask for password so do it first
puts "--" * 40
puts ANSI.yellow { "KeyRing v.#{keyring.version.to_s}: " } + ANSI.bold { @keyring_path }
+ puts ANSI.yellow { "fingerprint: " } + ANSI.bold{ ANSI.green { keyring.fingerprint } }
puts "--" * 40
keyring.keys.sort_by { |x| x&.tag || '' }.each(&method(:show_record))
if (keyring.keys.size > 0)
puts "--" * 40
puts "#{keyring.keys.size} key(s)\n"
else
puts "\nno keys\n"
end
+ }
+ }
+
+ opts.on("-x", "--change-password [NEW_PASSWORD]",
+ "change password. if the password it not specified, it ",
+ "will be requested. Don't forget to use -- to separate",
+ "this option from the repository name when needed") { |np|
+ task {
+ kr = keyring
+ new_password = np || request_password2("enter new password")
+ kr.change_password new_password
+ puts "password has been changed"
}
}
opts.on("--init", "-i", "initialize new keyring. Does not change any existing keyring") {
task {