Created
October 10, 2008 19:31
-
-
Save dstrelau/16136 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
#!/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 |
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
[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