Sha256: 7458d6be9f9f80d854aad8b9a6b1a2b2b2101b829674f9b93b31d30b420450ff
Contents?: true
Size: 909 Bytes
Versions: 5
Compression:
Stored size: 909 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.switch :long => 'mode-dev' do |s| s.description "Turn on development mode" end @program.command(:help) do |c| c.description "Display help documentation" c.skip_pre true c.skip_post true c.force true 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
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
rcoli-0.6.6 | lib/rcoli.rb |
rcoli-0.6.5 | lib/rcoli.rb |
rcoli-0.6.4 | lib/rcoli.rb |
rcoli-0.6.3 | lib/rcoli.rb |
rcoli-0.6.2 | lib/rcoli.rb |