Skip to content

Instantly share code, notes, and snippets.

@dstrelau
Created October 10, 2008 19:31
Show Gist options
  • Save dstrelau/16136 to your computer and use it in GitHub Desktop.
Save dstrelau/16136 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# module: abc
require 'rubygems'
require 'thor'
class Abc < Thor
desc 'debug', ''
def debug
puts "tasks:"
puts self.class.tasks.map{|k,v| k}
end
class Foo < Thor
desc "bar", "do the bar"
def bar
puts "BAR!"
puts "tasks:"
puts self.class.tasks.map{|k,v| k}
end
end
end
Abc.start
[abc] thor -T
The abc namespace doesn't have a `-T' task
Tasks
-----
abc:debug
abc:foo:bar do the bar
[abc] thor abc:debug
The abc namespace doesn't have a `abc:debug' task
tasks:
debug
help
[abc] thor abc:foo:bar
The abc namespace doesn't have a `abc:foo:bar' task
BAR!
tasks:
bar
help
[abc] ./abc.thor debug
tasks:
debug
help
[abc] ./abc.thor foo:bar
The abc namespace doesn't have a `foo:bar' task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment