Class: Warthog::CLI::CLI
- Inherits:
-
Object
- Object
- Warthog::CLI::CLI
- Defined in:
- lib/warthog/cli.rb
Constant Summary collapse
- COMMANDS =
%w(show)
Instance Method Summary collapse
-
#initialize(arguments) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(arguments) ⇒ CLI
Returns a new instance of CLI.
17 18 19 20 21 22 23 24 |
# File 'lib/warthog/cli.rb', line 17 def initialize(arguments) @arguments = arguments @whoami = File.basename($PROGRAM_NAME).to_sym @options = { :debug => false, :username => Etc.getlogin } @action = nil @elesai = nil end |
Instance Method Details
#run ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/warthog/cli.rb', line 26 def run begin arguments_valid? process_arguments process_command rescue => e #ArgumentError, OptionParser::MissingArgument, Senedsa::SendNsca::ConfigurationError => e if @options[:debug] "#{e.class}: #{e.}\n #{e.backtrace.join("\n ")}",1 else e.,1 end end end |