Created
January 16, 2012 14:44
-
-
Save leejarvis/1621183 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Slop version 3 | |
commands = Slop::Commands.new do | |
banner "ruby foo.rb [options]\n" | |
on 'new' do | |
on '-F', '--force', 'Force creation' | |
on '--outdir=', 'Output directory' | |
end | |
on 'version' do | |
add_callback(:empty) { p 'lolya' } | |
end | |
global do | |
on 'v', 'verbose', 'enable verbose mode' | |
end | |
default do | |
on 'a', 'auth', 'Auth mode' | |
end | |
end | |
puts commands #=> | |
__END__ | |
~/code/slop[v3]% ruby run.rb | |
ruby foo.rb [options] | |
new | |
-F, --force Force creation | |
--outdir Output directory | |
global | |
-v, --verbose enable verbose mode | |
Other options | |
-a, --auth Auth mode |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks pretty good. Liking it :)