Class: Route53::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/route53/cli.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arguments, stdin) ⇒ CLI

Returns a new instance of CLI.



13
14
15
16
17
18
19
20
21
# File 'lib/route53/cli.rb', line 13

def initialize(arguments, stdin)
  @arguments = arguments
  @stdin = stdin

  # Set defaults
  @options = OpenStruct.new
  @options.verbose = false
  @options.quiet = false
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



11
12
13
# File 'lib/route53/cli.rb', line 11

def options
  @options
end

Instance Method Details

#runObject

Parse options, check arguments, then process the command



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

def run
  if parsed_options? && arguments_valid?
    puts "Start at #{DateTime.now}\n\n" if @options.verbose

    output_options if @options.verbose # [Optional]

    process_arguments
    process_command

    puts "\nFinished at #{DateTime.now}" if @options.verbose

  else
    puts "ERROR: Invalid Options passed. Please run with --help"
    exit 1
  end

end