Sha256: 516196831d0fbc8ff283c3f5ac7f0e8e83adc9a5bef8dfed10605840cf9a207f

Contents?: true

Size: 637 Bytes

Versions: 9

Compression:

Stored size: 637 Bytes

Contents

require 'thor'

module ThorTemplate
  class Command < Thor
    class << self
      def dispatch(m, args, options, 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
        super
      end
    end
  end
end

Version data entries

9 entries across 7 versions & 1 rubygems

Version Path
thor_template-2.1.1 lib/thor_template/command.rb
thor_template-2.1.0 lib/thor_template/command.rb
thor_template-2.0.2 lib/thor_template/command.rb
thor_template-2.0.1 lib/thor_template/command.rb
thor_template-2.0.0 lib/thor_template/command.rb
thor_template-1.0.1 lib/thor_template/command.rb
thor_template-1.0.1 lib/starter_project/lib/thor_template/command.rb
thor_template-1.0.0 lib/starter_project/lib/thor_template/command.rb
thor_template-1.0.0 lib/thor_template/command.rb