Skip to content

Instantly share code, notes, and snippets.

@jendiamond
Created November 30, 2012 17:39
Show Gist options
  • Save jendiamond/4177269 to your computer and use it in GitHub Desktop.
Save jendiamond/4177269 to your computer and use it in GitHub Desktop.
chapter 2 todo
#!/usr/bin/env ruby
require 'rubygems'
require 'gli'
require 'todo-version'
include GLI::App
version Todo::VERSION
flag :f
desc ''
command :new do |c|
c.flag :priority
c.switch :f
c.action do |global_options,options,args|
puts "Global"
puts "-f - #{global_options[:f]}"
puts "Command:"
puts "-f - #{options[:f] ? 'true' : 'false'}"
puts"-p -#{options[:p]}"
puts "-args - #{args.join(',')}"
end
end
desc ''
command :list do |c|
c.flag :s
c.action do |global_options,options,args|
puts "Global:"
puts "-f - #{global_options[:f]}"
puts "Command:"
puts "-s #{options[:s]}"
end
end
desc ''
command :done do |c|
c.action do |global_options.options,args|
puts "Global:"
puts "-f - #{global_options[:f]}"
end
end
exit run(ARGV)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment