module GClouderUndefinedResources::CLIArgs

Public Class Methods

cli_args() click to toggle source
# File lib/gclouder_undefined_resources/cli_args.rb, line 5
def self.cli_args
  @cli_args ||= { debug: false }
end
included(klass) click to toggle source
# File lib/gclouder_undefined_resources/cli_args.rb, line 13
def self.included(klass)
  klass.extend CLIArgs
end
load() click to toggle source
# File lib/gclouder_undefined_resources/cli_args.rb, line 17
def self.load
  option_parser = Trollop::Parser.new do
    banner "\n  undefined gcp resources\n "

    opt :local_resources,    "file containing local resource definitions", type: :string, required: true
    opt :filter_config,      "file containing filter config", type: :string
    opt :key_file,           "specify key file for gcloud(1) authentication\n ", type: :string

    opt :group_by,           "how to format output. valid values include: location, type\n ", type: :string, default: "location"

    opt :show_filter_rule,   "show filter matching output", type: :bool
    opt :show_filter_name,   "include filter rule name in output\n ", type: :bool

    opt :hide_filtered,      "hide filtered results from output", type: :bool, default: false
    opt :hide_defined,       "hide defined results from output", type: :bool, default: false
    opt :hide_report,        "display statistics for each resource status type\n ", type: :bool

    opt :verbose,            "verbose\n ", type: :bool
  end

  @cli_args = Trollop.with_standard_exception_handling(option_parser) do
    raise Trollop::HelpNeeded if ARGV.empty?
    option_parser.parse ARGV
  end
end

Public Instance Methods

cli_args() click to toggle source
# File lib/gclouder_undefined_resources/cli_args.rb, line 9
def cli_args
  CLIArgs.cli_args
end