Sha256: bebbf08a9d846e071b6e766e381995119108689e897450547c29495abe8a4994

Contents?: true

Size: 704 Bytes

Versions: 49

Compression:

Stored size: 704 Bytes

Contents

class Rack::App::CLI::Command

  require 'optparse'
  require 'rack/app/cli/command/configurator'

  class << self

    def option_definitions
      @options_parser_options ||= []
    end

    def description(message = nil)
      @description = message unless message.nil?
      @description || ''
    end

    alias desc description

    def option(*args, &block)
      option_definitions << {:args => args, :block => block}
    end

    alias on option

    def action(&block)
      define_method(:action, &block)
    end

  end

  def options
    @options ||= {}
  end

  def action(*argv)
  end

  def start(argv)
    action(*argv)
  rescue ArgumentError => ex
    $stderr.puts(ex.message)
  end

end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
rack-app-7.2.2 lib/rack/app/cli/command.rb
rack-app-7.2.1 lib/rack/app/cli/command.rb
rack-app-7.2.0 lib/rack/app/cli/command.rb
rack-app-7.1.0 lib/rack/app/cli/command.rb
rack-app-7.0.0 lib/rack/app/cli/command.rb
rack-app-6.8.0 lib/rack/app/cli/command.rb
rack-app-6.7.1 lib/rack/app/cli/command.rb
rack-app-6.7.0 lib/rack/app/cli/command.rb
rack-app-6.6.0 lib/rack/app/cli/command.rb
rack-app-6.5.0 lib/rack/app/cli/command.rb
rack-app-6.4.1 lib/rack/app/cli/command.rb
rack-app-6.4.0 lib/rack/app/cli/command.rb
rack-app-6.3.3 lib/rack/app/cli/command.rb
rack-app-6.3.2 lib/rack/app/cli/command.rb
rack-app-6.3.1 lib/rack/app/cli/command.rb
rack-app-6.3.0 lib/rack/app/cli/command.rb
rack-app-6.2.0 lib/rack/app/cli/command.rb
rack-app-6.1.0 lib/rack/app/cli/command.rb
rack-app-6.0.0 lib/rack/app/cli/command.rb
rack-app-5.12.0 lib/rack/app/cli/command.rb