In my gem I'd like to have a an executable command with args like so:
foo generate project
foo generate config
foo say_hi
So I made
foo/bin/foo
#!/usr/bin/env ruby
require 'foo'
Foo::Foo.start
And the Foo file in foo/lib/thor/foo.rb
module Foo
class Foo < Thor
desc "generate [WHAT]"
def generate(*args)
end
desc "say_hi"
def say_hi(*args)
....
end
end
end
And foo/lib/thor/generators/project.rb And foo/lib/thor/generators/config.rb
Where I'd like to specify classes inherited from Thor::Group like katz examples ...
module Foo
module Generators
class Project < Thor::Group
include Thor::Actions
....
end
end
end
So my question is: How do I set things up so that I can call those generators from the executable like:
foo generate config
Am I on the right track even? Ideally, typing foo
on its own should give help for say_hi
and for all the generators.