class ROTP::Arguments

def parser

def parser
  OptionParser.new do |parser|
    parser.banner = ''
    parser.separator green('  Usage: ') + bold("#{filename} [options]")
    parser.separator ''
    parser.separator green '  Examples:   '
    parser.separator '    ' + bold("#{filename} --secret p4ssword") + '                       # Generates a time-based one-time password'
    parser.separator '    ' + bold("#{filename} --hmac --secret p4ssword --counter 42") + '   # Generates a counter-based one-time password'
    parser.separator ''
    parser.separator green '  Options:'
    parser.on('-s', '--secret [SECRET]', 'The shared secret') do |secret|
      options!.secret = secret
    end
    parser.on('-c', '--counter [COUNTER]', 'The counter for counter-based hmac OTP') do |counter|
      options!.counter = counter.to_i
    end
    parser.on('-t', '--time', 'Use time-based OTP according to RFC 6238 (default)') do
      options!.mode = :time
    end
    parser.on('-m', '--hmac', 'Use counter-based OTP according to RFC 4226') do
      options!.mode = :hmac
    end
    parser.on_tail('-h', '--help', 'Show this message') do
      options!.mode = :help
    end
    parser.on('-d', '--digest [ALGORITHM]', 'Use algorithm for the digest (default sha1)') do |digest|
      options!.digest = digest
    end
  end
end