Skip to content

Instantly share code, notes, and snippets.

@tj
Created April 10, 2009 01:27
Show Gist options
  • Save tj/92862 to your computer and use it in GitHub Desktop.
Save tj/92862 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
require 'commander'
program :version, '0.0.1'
program :description, 'Does some foo'
global_option '-c', '--config FILE', 'Load configuration'
command :bar do |c|
c.syntax = 'foo bar [options]'
c.when_called do |args, options|
p options.config
end
end
# $ ./foo bar --config somepath
# => "somepath"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment