Title / Description
Code #!/usr/bin/env ruby require 'optparse_plus' first_value, second_value = nil, nil OptionParser.new_with_yaml do |opt| opt.inherit_ruby_options("E") # Currently, -E and -d only are available options opt.on(:first_option) {|status| first_value = status } opt.on(:second_option) {|arg| second_value = arg } opt.parse! end puts "The value returned from the first option is '#{first_value}'" puts "The value returned from the second option is '#{second_value}'" __END__ banner: test_program.rb [OPTION] first_option: short: -f long: --first description: First option for a test script second_option: short: -s [arg] long: --second [=arg] description: Second option for a test script
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code