Method: LibGems::Command#initialize

Defined in:
lib/libgems/command.rb

#initialize(command, summary = nil, defaults = {}) ⇒ Command

Initializes a generic gem command named command. summary is a short description displayed in ‘gem help commands`. defaults are the default options. Defaults should be mirrored in #defaults_str, unless there are none.

When defining a new command subclass, use add_option to add command-line switches.

Unhandled arguments (gem names, files, etc.) are left in options[:args].



116
117
118
119
120
121
122
123
124
125
# File 'lib/libgems/command.rb', line 116

def initialize(command, summary=nil, defaults={})
  @command = command
  @summary = summary
  @program_name = "gem #{command}"
  @defaults = defaults
  @options = defaults.dup
  @option_groups = Hash.new { |h,k| h[k] = [] }
  @parser = nil
  @when_invoked = nil
end