Sha256: 42eec782141145208c73ea0a2d7d24ab6ee624862c30dc45b73ad96d48c9522e

Contents?: true

Size: 701 Bytes

Versions: 23

Compression:

Stored size: 701 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 action(*argv)
    raise NotImplementedError
  end

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

end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
rack-app-11.0.2 lib/rack/app/cli/command.rb
rack-app-11.0.1 lib/rack/app/cli/command.rb
rack-app-11.0.0 lib/rack/app/cli/command.rb
rack-app-10.0.0 lib/rack/app/cli/command.rb
rack-app-9.0.0 lib/rack/app/cli/command.rb
rack-app-8.1.0 lib/rack/app/cli/command.rb
rack-app-8.0.1 lib/rack/app/cli/command.rb
rack-app-8.0.0 lib/rack/app/cli/command.rb
mountapi-0.11.1 vendor/bundle/ruby/2.7.0/gems/rack-app-7.7.0/lib/rack/app/cli/command.rb
rack-app-7.7.0 lib/rack/app/cli/command.rb
rack-app-7.6.5 lib/rack/app/cli/command.rb
rack-app-7.6.4 lib/rack/app/cli/command.rb
rack-app-7.6.3 lib/rack/app/cli/command.rb
rack-app-7.6.2 lib/rack/app/cli/command.rb
rack-app-7.6.1 lib/rack/app/cli/command.rb
rack-app-7.6.0 lib/rack/app/cli/command.rb
rack-app-7.5.2 lib/rack/app/cli/command.rb
rack-app-7.5.1 lib/rack/app/cli/command.rb
rack-app-7.5.0 lib/rack/app/cli/command.rb
rack-app-7.4.0 lib/rack/app/cli/command.rb