Sha256: d03384e5ce59ea49c555b3b6b93df2d7ca43df0b5756e3d13e600e9464a8887a
Contents?: true
Size: 753 Bytes
Versions: 3
Compression:
Stored size: 753 Bytes
Contents
require 'optparse' module CookbookReader class Options attr_reader :path_to_search def initialize(argv) parse(argv) end private 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 end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cookbook-reader-0.1.2 | lib/cookbook-reader/options.rb |
cookbook-reader-0.1.1 | lib/cookbook-reader/options.rb |
cookbook-reader-0.1.0 | lib/cookbook-reader/options.rb |