diff options
author | icy <kyanh@viettug.org> | 2012-05-04 15:41:04 +0700 |
---|---|---|
committer | mh <mh@immerda.ch> | 2012-12-29 15:37:38 +0100 |
commit | 8aff193682579cdf9504a17e3d65ae91316833a6 (patch) | |
tree | 56df70dfebe460d44edf413cbe7302b1e63ac679 | |
parent | 579392bb39f1bb80be4c7d2b04e7ae5132b8a84e (diff) |
--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.
-rwxr-xr-x | bin/trocla | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -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), |