class Google::Idtoken::Verifier::CLI::App

Main class for the executable 'google_idtoken_verifier' @example

$ google_idtoken_verifier -h

Attributes

args[R]

Arguments the application was called with

out[R]

Output buffer

Public Class Methods

new(args, out = Out.new) click to toggle source
# File lib/google/idtoken/verifier/cli/app.rb, line 22
def initialize(args, out = Out.new)
  @args = args
  @out  = out
end
start() click to toggle source
# File lib/google/idtoken/verifier/cli/app.rb, line 13
def self.start
  App.new(ARGV).run
end

Public Instance Methods

check(id_token) click to toggle source
# File lib/google/idtoken/verifier/cli/app.rb, line 35
def check(id_token)
  Commands::Check.run(id_token)
end
run() click to toggle source
# File lib/google/idtoken/verifier/cli/app.rb, line 27
def run
  if args.empty?
    out.print opt_parser
  else
    opt_parser.parse!(args)
  end
end
version() click to toggle source
# File lib/google/idtoken/verifier/cli/app.rb, line 39
def version
  Commands::Version.run
end

Private Instance Methods

opt_parser() click to toggle source
# File lib/google/idtoken/verifier/cli/app.rb, line 45
def opt_parser
  OptionParser.new do |opts|
    opts.banner = "Usage: google_idtoken_verifier [options]"

    opts.separator ""
    opts.separator "Options:"

    opts.on("-c", "--verify ID_TOKEN",
            "Verify an Google Signin ID token") do |token|
      check(token)
    end

    opts.on_tail("-h", "--help", "Show this message") do
      out.print opts
    end

    opts.on_tail("-v", "--version", "Show version") do
      version
    end
  end
end