summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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),