Created
February 18, 2012 17:06
-
-
Save hoolymama/1860206 to your computer and use it in GitHub Desktop.
commandline thor generators with invocations
This file contains hidden or 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
module Flak | |
class CLI < Thor | |
register(Generate, 'generate', 'generate <something>', 'Generate a new something.') | |
end | |
end |
This file contains hidden or 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 | |
require 'flak' | |
# start CLI as a shell command | |
Flak::CLI.start |
This file contains hidden or 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
module Flak | |
class Generate < Thor | |
desc "project [name]", "Prints the project making step" | |
def project(name) | |
puts "making first project file #{name}" | |
invoke :config | |
invoke :project_sub | |
end | |
desc "config [name]", "Prints the config making step" | |
def config(name) | |
puts "making first config file #{name}" | |
invoke :project_sub | |
end | |
desc "project_sub [name]", "Prints the project_sub making step" | |
def project_sub(name) | |
puts "making subsystem file #{name}" | |
end | |
def self.banner(task, namespace = false, subcommand = true) | |
task.formatted_usage(self, true, subcommand).split(':').join(' ') | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment