From 8aff193682579cdf9504a17e3d65ae91316833a6 Mon Sep 17 00:00:00 2001 From: icy Date: Fri, 4 May 2012 15:41:04 +0700 Subject: --pwd-from-stdin now can read from STDIN. You can use pipe to provide multiple line password. Side effect: you can use trocla to store/retreive any kind of data, for example, public SSH key for your deployment tool. The former way of --pwd-from-stdin should be provided by the option --password / -p. STDIN has a different mean, IMHO. --- bin/trocla | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/bin/trocla b/bin/trocla index 824f5ec..ccceb51 100755 --- a/bin/trocla +++ b/bin/trocla @@ -26,15 +26,20 @@ OptionParser.new do |opts| opts.on("--no-random") do options['random'] = false end - + opts.on("--length LENGTH") do |v| options['length'] = v.to_i end - + + opts.on("--password PASSWORD", "-p", "Provide password at command line") do |pass| + options[:ask_password] = false + options[:password] = pass + end + opts.on("--pwd-from-stdin") do options[:ask_password] = false end - + end.parse! @@ -65,7 +70,9 @@ def set(options) exit 1 end else - password = options.delete(:other_options).shift + # FIXME: I don't know if we have to delete other options here. + password = options.delete(:password) + password = STDIN.read if not password end Trocla.new(options.delete(:config_file)).set_password( options.delete(:trocla_key), -- cgit v1.2.3