require 'optparse' module TimeCop class OptionParser attr_reader :args def initialize(args) @args = args end def parse options = {} option_parser = ::OptionParser.new do |opts| opts.on("-u USERNAME", "--username=USERNAME", "Username to authenticate as") do |username| options[:username] = username end opts.on("-p PASSWORD", "--password=PASSWORD", "Passsword to authenticate with") do |password| options[:password] = password end opts.on("-h", "--help", "Prints help") do puts opts exit end end option_parser.parse(args) unless options[:username] && options[:password] puts "Please specify a username and password" puts option_parser exit end options end end end