summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoricy <kyanh@viettug.org>2012-05-04 15:41:04 +0700
committermh <mh@immerda.ch>2012-12-29 15:37:38 +0100
commit8aff193682579cdf9504a17e3d65ae91316833a6 (patch)
tree56df70dfebe460d44edf413cbe7302b1e63ac679
parent579392bb39f1bb80be4c7d2b04e7ae5132b8a84e (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-xbin/trocla15
1 files 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),