Skip to content

Instantly share code, notes, and snippets.

@rummelonp
Forked from takkkun/command.rb
Last active December 15, 2015 20:09
Show Gist options
  • Save rummelonp/5316599 to your computer and use it in GitHub Desktop.
Save rummelonp/5316599 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'thor'
class Command < Thor
class Example < Thor
::Command.register(self, :example, 'example [COMMAND]', 'example namespace')
class App < Thor
Example.register(self, :app, 'app [COMMAND]', 'app namespace')
desc :install, 'install something'
def install
puts 'run example app install'
end
end
end
end
Command.start
$ ./command.rb example app install
run example app install
$ ./command.rb help
Commands:
command.rb app [COMMAND] # app namespace
command.rb example [COMMAND] # example namespace
command.rb example [COMMAND] # example namespace
command.rb help [COMMAND] # Describe subcommands or one specific subcommand
command.rb help [COMMAND] # Describe available commands or one specific command
# ヘルプの表示がおかしいし実際 Command には example と help タスクしかない
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment