Module: GemRelease::CommandOptions

Defined in:
lib/gem_release/command_options.rb

Instance Method Summary collapse

Instance Method Details

#initialize(*args) ⇒ Object



3
4
5
6
# File 'lib/gem_release/command_options.rb', line 3

def initialize(*args)
  @arguments = ''
  super
end

#option(key, short, description) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/gem_release/command_options.rb', line 8

def option(key, short, description)
  options = self.class::OPTIONS
  default = options[key]

  if String === default
    long = "--#{key} #{key.to_s.upcase}"
    args = [short, long, String, "#{description} (defaults to #{default})"]
  else
    long = "--[no-]#{key}"
    args = [short, long, "#{description} (defaults to #{default})"]
  end

  add_option(*args) { |value, options| options[key] = value }
end