add func to return timestamp

This commit is contained in:
Alexander Popov 2022-01-03 23:32:49 +03:00
parent 9720dee187
commit a73d5ec9dd

View File

@ -1,3 +1,4 @@
require "option_parser"
require "yaml" require "yaml"
require "colorize" require "colorize"
@ -22,6 +23,27 @@ end
VERSION = "0.1.0" VERSION = "0.1.0"
OptionParser.parse do |parser|
parser.banner = "Welcome to The Beatles App!"
parser.on "-v", "--version", "Show version" do
puts "Version #{VERSION}"
exit
end
parser.on "-h", "--help", "Show help" do
puts parser
exit
end
parser.on "-g", "--generate-password", "Generate password" do
puts "---"
exit
end
parser.on "-t", "--unixtime", "Return local timestamp" do
puts Time.local.to_unix
exit
end
end
if !File.exists?("pwd.yml") if !File.exists?("pwd.yml")
puts "No password.yml file exists." puts "No password.yml file exists."
@ -49,7 +71,7 @@ while true
exit(0) exit(0)
elsif password_string.to_s == ":h" elsif password_string.to_s == ":h"
puts "Help:\n-----" puts "Help:\n-----"
puts ":s - return stats" puts "\t:s - Return stats"
elsif password_string.to_s == ":s" elsif password_string.to_s == ":s"
print "Elements: ".colorize(:yellow) print "Elements: ".colorize(:yellow)