module Subcommands

override the output from optparse to be a bit more aesthetically pleasing

Public Instance Methods

command(*names) { |opts| ... } click to toggle source
# File lib/aws-carb/monkey_patches.rb, line 61
def command *names
  name = names.shift

  @commands ||= {}
  @aliases  ||= {}

  names.each { |n| @aliases[n.to_s] = name.to_s } if names.length > 0

  opt = lambda do
    OptionParser.new do |opts|
      yield opts
      opts.banner << "OPTIONS"
    end
  end

  @commands[name.to_s] = opt
end
print_actions() click to toggle source