Class: MachineConfigure::CLI

Inherits:
Object
  • Object
show all
Includes:
CLIConstants, Helpers::Message
Defined in:
lib/machine_configure/cli.rb

Constant Summary

Constants included from CLIConstants

MachineConfigure::CLIConstants::HELP_TEXT, MachineConfigure::CLIConstants::VALID_ARGUMENTS

Constants included from Helpers::Message

Helpers::Message::MESSAGE_PADDING, Helpers::Message::STACK_TRACE_PADDING, Helpers::Message::STACK_TRACE_SIZE

Instance Method Summary collapse

Methods included from Helpers::Message

error_no_stack_trace!, error_yes_stack_trace!

Constructor Details

#initializeCLI

Returns a new instance of CLI.



6
7
8
9
# File 'lib/machine_configure/cli.rb', line 6

def initialize
  Helpers::Message.error_no_stack_trace!
  @arguments = nil
end

Instance Method Details

#runObject

Parses given command-line arguments, and sets proper settings.



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/machine_configure/cli.rb', line 13

def run
  @arguments = ArgumentParser.get_arguments VALID_ARGUMENTS
  print_help     if (@arguments[:options][:help])
  print_version  if (@arguments[:options][:version])
  if    (@arguments[:keywords][:export])
    handle_export
  elsif (@arguments[:keywords][:import])
    handle_import
  else
    print_help
  end
end