class Earthquake::OptionParser
Constants
- Help
Public Class Methods
new(argv)
click to toggle source
# File lib/earthquake/option_parser.rb, line 7 def initialize(argv) @argv = argv @slop = setup_slop end
Public Instance Methods
parse()
click to toggle source
# File lib/earthquake/option_parser.rb, line 12 def parse @slop.parse!(@argv) options = @slop.to_hash raise Help if options.delete(:help) options[:dir] = @argv.shift unless @argv.empty? options end
Private Instance Methods
setup_slop()
click to toggle source
# File lib/earthquake/option_parser.rb, line 22 def setup_slop Slop.new(:strict => true, :help => true).tap do |s| s.banner 'Usage: earthquake [options] [directory]' s.on :d, :debug, 'Enable debug mode' s.on :n, :'no-logo', 'No Logo' s.on :c, :command, 'Invoke a command and exit', :argument => true s.on :'--no-stream', 'No stream mode' end end