36 lines
1.2 KiB
Crystal
36 lines
1.2 KiB
Crystal
begin
|
|
OptionParser.parse do |parser|
|
|
parser.banner = "The very simple password manager for humans\n"
|
|
|
|
parser.on "-v", "--version", "Show version" do
|
|
puts ASCII_LOGO.colorize(:yellow)
|
|
puts "The very simple password manager for humans.".colorize(:yellow)
|
|
print "Version ".colorize(:yellow)
|
|
puts VERSION.colorize(:red).mode(:bold)
|
|
puts "\nURL to full changes log: ".colorize(:yellow)
|
|
puts "https://git.a2s.su/iiiypuk/pmng/raw/branch/master/HISTORY.md".colorize(:green).mode(:bold)
|
|
|
|
exit(0)
|
|
end
|
|
parser.on "-h", "--help", "Show help" do
|
|
puts parser
|
|
|
|
exit(0)
|
|
end
|
|
parser.on "-g", "--generate-password", "Generate password" do
|
|
puts Random::Secure.urlsafe_base64(16, padding: false).colorize(:black).back(:white)
|
|
puts Random::Secure.urlsafe_base64(16, padding: false).colorize(:white).back(:blue)
|
|
puts Random::Secure.urlsafe_base64(16, padding: false).colorize(:white).back(:red)
|
|
|
|
exit(0)
|
|
end
|
|
parser.on "-t", "--unixtime", "Return local timestamp" do
|
|
puts Time.local.to_unix.colorize(:yellow).mode(:bold)
|
|
|
|
exit(0)
|
|
end
|
|
end
|
|
rescue ex
|
|
puts ex.message, ""
|
|
end
|