Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 48 lines (39 sloc) 1.13 kB
#!/usr/bin/env ruby
$: << File.dirname(__FILE__) + "/../lib"
require "optparse"
require "haddock"
include Haddock
OptionParser.new do |opts|
opts.banner = "usage: #{File.basename($0)} [options]"
opts.on("-V", "--version") do
puts "#{File.basename($0)}: v#{Haddock::VERSION}"
exit
end
opts.on("-h", "--help") do
puts opts
exit
end
opts.on("-l", "--length [length]", Integer) do |value|
@length = value
end
opts.on("-f", "--words [words file]") do |value|
Password.diction = value
end
opts.on("-d", "--delimiters [symbols]") do |value|
Password.delimiters = value
end
begin
opts.parse!
puts @length ? Password.generate(@length) : Password.generate
rescue OptionParser::ParseError, Password::LengthError => error
warn "#{File.basename($0)}: #{error.message} " +
"(must be between #{Password::MINIMUM} and #{Password::MAXIMUM})."
puts opts
abort
rescue Password::NoWordsError => error
warn "#{File.basename($0)}: #{error.message}."
puts "Word lists are available here: http://wordlist.sourceforge.net"
puts opts
abort
end
end
Jump to Line
Something went wrong with that request. Please try again.