Method: ROTP::CLI#output

Defined in:
lib/rotp/cli.rb

#outputObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rotp/cli.rb', line 28

def output
  return options.warnings if options.warnings
  return errors if errors
  return arguments.to_s if options.mode == :help

  if options.mode == :time
    ROTP::TOTP.new(options.secret).now
  elsif options.mode == :hmac
    ROTP::HOTP.new(options.secret).at options.counter

  else
    fail NotImplementedError
  end
end