Class: ThorTemplate::Command
- Defined in:
- lib/thor_template/command.rb,
lib/starter_project/lib/thor_template/command.rb
Direct Known Subclasses
Class Method Summary collapse
Class Method Details
.dispatch(m, args, options, config) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/thor_template/command.rb', line 6 def dispatch(m, args, , config) # Allow calling for help via: # thor_template command help # thor_template command -h # thor_template command --help # thor_template command -D # # as well thor's normal way: # # thor_template help command help_flags = Thor::HELP_MAPPINGS + ["help"] if args.length > 1 && !(args & help_flags).empty? args -= help_flags args.insert(-2, "help") end # thor_template version # thor_template --version # thor_template -v version_flags = ["--version", "-v"] if args.length == 1 && !(args & version_flags).empty? args = ["version"] end super end |