-
-
Save dunedain289/3124276 to your computer and use it in GitHub Desktop.
Thor layout for NewReg
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
require "cli.rb" | |
CLI::Base.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
require 'thor' | |
module CLI | |
class Two < Thor | |
desc "twotwo", "output twotwo" | |
def twotwo | |
puts "twotwo" | |
end | |
end | |
class Three < Thor | |
desc "threethree", "output threethree" | |
def threethree | |
puts '33' | |
end | |
end | |
class Base < Thor | |
desc "two SUBCOMMAND ...ARGS", "manage stuff for two" | |
subcommand "two", Two | |
desc "three SUBCOMMAND ...ARGS", "manage stuff for three" | |
subcommand "three", Three | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
app two twotwo
-- runsCLI::Two#twotwo
app three threethree
-- runsCLI::Three#threethree
app
-- prints top-level help, just listing subcommandsapp two
-- prints help forCLI::Two
, listingtwotwo
only