class CookbookReader::Options
Attributes
path_to_search[R]
Public Class Methods
new(argv)
click to toggle source
# File lib/cookbook-reader/options.rb, line 8 def initialize(argv) parse(argv) end
Private Instance Methods
parse(argv)
click to toggle source
# File lib/cookbook-reader/options.rb, line 14 def parse(argv) OptionParser.new do |opts| opts.banner = "Usage: cookbook-reader --path path ..." opts.on("-p", "--path path", String, "Path to search") do |path| @path_to_search = path end opts.on("-h", "--help", "Show this message") do puts opts exit end begin argv = ["-h"] if argv.empty? opts.parse!(argv) rescue OptionParser::ParseError => e STDERR.puts e.message, "\n", opts exit(-1) end end end