class Roast::CLI
Constants
- BANNER
Public Instance Methods
parse_options()
click to toggle source
Use OptionParser to parse options, then we remove them from ARGV
# File lib/roast/cli.rb, line 36 def parse_options @opts = OptionParser.new do |opts| opts.banner = BANNER.gsub(/^ {4}/, '') opts.separator '' opts.separator 'Options:' opts.on('-v', 'Print the version') do puts Roast::VERSION exit end opts.on( '-h', '--help', 'Display this help.' ) do puts opts exit end end @opts.parse! end
print_usage_and_exit!()
click to toggle source
# File lib/roast/cli.rb, line 57 def print_usage_and_exit! puts @opts exit end
run()
click to toggle source
Called from the executable. Parses the command line arguments
# File lib/roast/cli.rb, line 63 def run parse_options print_usage_and_exit! if ARGV.empty? dispatch end