Class: DTK::Client::CommandBaseOptionParser

Inherits:
Object
  • Object
show all
Extended by:
Auxiliary
Includes:
CommandBase
Defined in:
lib/parser/adapters/option_parser.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Auxiliary

cap_form, snake_form

Methods included from CommandBase

#get, #get_connection, handle_argument_error, #post, #post_file, #rest_url, #rotate_args

Constructor Details

#initialize(conn) ⇒ CommandBaseOptionParser

Returns a new instance of CommandBaseOptionParser.



23
24
25
# File 'lib/parser/adapters/option_parser.rb', line 23

def initialize(conn)
  @conn = conn
end

Class Method Details

.command_nameObject



36
37
38
# File 'lib/parser/adapters/option_parser.rb', line 36

def command_name()
  snake_form(self,"-")
end

.execute_from_cli(conn, argv, shell_execute = false) ⇒ Object

Raises:



27
28
29
30
31
32
33
# File 'lib/parser/adapters/option_parser.rb', line 27

def self.execute_from_cli(conn,argv,shell_execute=false)
  return conn.connection_error if conn.connection_error
  method, args_hash = OptionParser.parse_options(self,argv)
  instance = new(conn)
  raise Error.new("Illegal subcommand #{method}") unless instance.respond_to?(method)
  instance.send(method,args_hash)
end