Skip to content

Instantly share code, notes, and snippets.

@makefunstuff
Created October 22, 2014 08:32
Show Gist options
  • Save makefunstuff/b8688bcf3139ed9cba43 to your computer and use it in GitHub Desktop.
Save makefunstuff/b8688bcf3139ed9cba43 to your computer and use it in GitHub Desktop.
require 'optparse'
# options hash to store parsed results
options = {}
# initialize option parser
OptionParser.new do |opts|
# provide banner with basic usage example
opts.banner = "USAGE do awesome stuff"
# our rule to parse
opts.on("-m", "--magick", "This stores our magick value") do |v|
options[:magick] = v
end
end.parse!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment