Sha256: 2ace41f7bc863181e5a44e087922a4ca2cdc3672f44d0a08bc5b730892348c9f

Contents?: true

Size: 765 Bytes

Versions: 2

Compression:

Stored size: 765 Bytes

Contents

require 'highline/import'
require 'rcoli/utils'
require 'rcoli/extensions'
require 'rcoli/help'
require 'rcoli/model'


@program = RCoLi::Program.new

def application(id, &block)
  @program.name id
  
  @program.switch long: 'debug' do |s|
    s.description "Turn on debugging"
  end
  
  @program.command(:help) do |c|
    c.description "Display help documentation"
    c.solitaire
    c.action do |global_opts, opts, args|
      @program.help args
    end
  end
  
  @program.instance_eval &block
  
end

at_exit {
  begin
    @program.execute(ARGV, self)
  rescue InvalidCommand => e
    say "#{@program.value_of_name}: #{e.message}. See '#{@program.value_of_name} help'"
  rescue ApplicationError => e
    say($terminal.color "#{e.message}", :red)
  end
    
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rcoli-0.5.7 lib/rcoli.rb
rcoli-0.5.6 lib/rcoli.rb