Sha256: 39442063b5fa8da3a0b1d8fdb1d348c871075868fc3c3491d69ed4a383fbaa80
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
require "thor" # Override thor's long_desc identation behavior # https://github.com/erikhuda/thor/issues/398 class Thor module Shell class Basic def print_wrapped(message, options = {}) message = "\n#{message}" unless message[0] == "\n" stdout.puts message end end end end module <%= project_class_name %> class Command < Thor class << self def dispatch(m, args, options, config) # Allow calling for help via: # <%= project_name %> command help # <%= project_name %> command -h # <%= project_name %> command --help # <%= project_name %> command -D # # as well thor's normal way: # # <%= project_name %> help command help_flags = Thor::HELP_MAPPINGS + ["help"] if args.length > 1 && !(args & help_flags).empty? args -= help_flags args.insert(-2, "help") end # <%= project_name %> version # <%= project_name %> --version # <%= project_name %> -v version_flags = ["--version", "-v"] if args.length == 1 && !(args & version_flags).empty? args = ["version"] end super end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cli-template-3.3.0 | lib/templates/default/lib/%underscored_name%/command.rb.tt |
cli-template-3.2.0 | lib/templates/default/lib/%underscored_name%/command.rb.tt |