Sha256: f5d69c51351d3309d5e6d83ec54d6c9963452e2e85593cba3c9434322520675b

Contents?: true

Size: 544 Bytes

Versions: 3

Compression:

Stored size: 544 Bytes

Contents

require 'optparse'

class SubCommand
  include Commandeer

  command "bar", :parent => 'fakeparent'

  def self.parse(args)
    options = {}
    opts = OptionParser.new do |opts|
      opts.banner = "bar [options]"

      opts.on("-b", "--bar BARTHING", "The option for bar") do |f|
        options[:f] = f
      end
      opts.on_tail("-h", "--help", "bar help") do
        puts opts
        exit(1)
      end
    end
    begin
      opts.parse!(args)
    rescue OptionParser::InvalidOption => e
      puts e
      puts opts
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
commandeer-0.1.1 test/helpers/subcommand.rb
commandeer-0.1.0 test/helpers/subcommand.rb
commandeer-0.0.1 test/helpers/subcommand.rb