Created
November 30, 2012 17:39
-
-
Save jendiamond/4177269 to your computer and use it in GitHub Desktop.
chapter 2 todo
This file contains hidden or 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
#!/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