Sha256: 9ccfd33835a21489c061bebf9ec019f9357ce0c4f35c3811a98d0b247c53d8c9

Contents?: true

Size: 640 Bytes

Versions: 1

Compression:

Stored size: 640 Bytes

Contents

module Mercenary
  class Program < Command
    attr_reader :version
    attr_reader :description
    attr_reader :optparse
    attr_reader :config

    def initialize(name)
      @config = {}
      super(name)
    end

    def version(version)
      @version = version
    end

    def description(description)
      @description = description
    end

    def go(argv)
      p argv
      puts
      p self

      cmd = nil

      @optparse = OptionParser.new do |opts|
        cmd = super(argv, opts, @config)
      end

      @optparse.parse!(argv)

      p @config

      cmd.actions.each { |a| a.call(argv, @config) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mercenary-0.0.1 lib/mercenary/program.rb