Skip to content

Instantly share code, notes, and snippets.

@RyanScottLewis
Last active August 29, 2015 14:11
Show Gist options
  • Select an option

  • Save RyanScottLewis/915a4192e3c2c4729447 to your computer and use it in GitHub Desktop.

Select an option

Save RyanScottLewis/915a4192e3c2c4729447 to your computer and use it in GitHub Desktop.
RyBookPro:Desktop ryguy$ ./slop_iterm_example
{:terminal=>"iTerm", :help=>nil}
RyBookPro:Desktop ryguy$ ./slop_iterm_example --help
Usage: slop_iterm_example [options]
-t, --terminal Terminal to use. (default: iTerm)
-h, --help Display this help message.
RyBookPro:Desktop ryguy$ ./slop_iterm_example --terminal=MyTerm
{:terminal=>"MyTerm", :help=>nil}
RyBookPro:Desktop ryguy$ ./slop_iterm_example --terminal MyTerm
{:terminal=>"MyTerm", :help=>nil}
RyBookPro:Desktop ryguy$ ./slop_iterm_example -t MyTerm
{:terminal=>"MyTerm", :help=>nil}
RyBookPro:Desktop ryguy$ ./slop_iterm_example -t=MyTerm
{:terminal=>"MyTerm", :help=>nil}
RyBookPro:Desktop ryguy$
#!/usr/bin/env ruby
require 'slop'
options = Slop.parse( help: true ) do
on :t, :terminal=, 'Terminal to use.', default: 'iTerm'
end
p options.to_hash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment