Class: Bogo::Cli::Setup

Inherits:
Object
  • Object
show all
Defined in:
lib/bogo-cli/setup.rb

Class Method Summary collapse

Class Method Details

.define { ... } ⇒ TrueClass

Wrap slop setup for consistent usage

Yields:

  • Slop setup block

Returns:

  • (TrueClass)


13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/bogo-cli/setup.rb', line 13

def define(&block)
  begin
    Slop.parse(:help => true) do
      instance_exec(&block)
    end
  rescue => e
    if(ENV['DEBUG'])
      $stderr.puts "ERROR: #{e.class}: #{e}\n#{e.backtrace.join("\n")}"
    end
    exit -1
  end
  true
end