Class: ClassicApi::Command::Base

Inherits:
Thor
  • Object
show all
Defined in:
lib/classic_api/command/base.rb

Direct Known Subclasses

Images, Main, Users

Class Method Summary collapse

Class Method Details

.apiObject



21
22
23
# File 'lib/classic_api/command/base.rb', line 21

def api
  ClassicApi
end

.handle_argument_error(command, error, args, arity) ⇒ Object

:nodoc:



13
14
15
16
17
18
19
# File 'lib/classic_api/command/base.rb', line 13

def handle_argument_error(command, error, args, arity) #:nodoc:
  message = "#{basename} #{command.name} was called with "
  message << "no arguments"               if     args.empty?
  message << "arguments " << args.inspect unless args.empty?
  Util::Format.print_error("Invalid Arguments", message)
  Util::Format.print_info("USAGE", banner(command).inspect)
end

.start(given_args = ARGV, config = {}) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/classic_api/command/base.rb', line 5

def start(given_args = ARGV, config = {})
  config[:shell] ||= Thor::Base.shell.new
  dispatch(nil, given_args.dup, nil, config)
rescue StandardError => e
  Util::Format.show_error(e)
  exit(1)
end