Published in: Other
op = OptionParser.new do |opts| opts.banner = "Usage: #{$0} [options] directory." opts.on('-v', '--verbose', 'Run verbosely') do |v| options[:verbose] = v end opts.on('-o [TYPE]', '--output [TYPE]', "Output as: #{output_types.join(', ')}.") do |o| raise Exception.new("Invalid output type: #{o}") unless output_types.include?(o) options[:output] = o.to_sym end opts.on('-m [MIN_SIZE]', '--minimum-size [MIN_SIZE]', 'Minimum word size to capture.') do |m| options[:min_word_size] = m.to_i end opts.on('-p', '--preserve-case', 'Preserves the case of words.') do |p| options[:preserve_case] = p end opts.on_tail("-h", "--help", "Show this message") do puts opts exit end end
You need to login to post a comment.
