Thorでは以下のようなサブコマンド、サブサブコマンドも簡単に作ることができます。
$ ./foo bar baz qux
qux
foo
require 'thor'
require 'thor/group'
class Baz < Thor
namespace 'bar baz'
desc 'qux', 'qux!!!'
def qux
puts 'qux'
end
def self.banner(task, namespace = false, subcommand = true)
super
end
end
class Bar < Thor
namespace :bar
register(Baz, 'baz', 'baz [COMMAND]', 'subcommad for baz')
def self.banner(task, namespace = false, subcommand = true)
super
end
end
class Foo < Thor
register(Bar, 'bar', 'bar [COMMAND]', 'commands for bar')
end
Foo.start