Sha256: 4c4e9c3933a665bd2663aa51ae8f9ca2f8f0f5187408dd5f6debdcb07379b150

Contents?: true

Size: 614 Bytes

Versions: 5

Compression:

Stored size: 614 Bytes

Contents

require "thor"

module Inventory
  class Command < Thor
    class << self
      def dispatch(m, args, options, config)
        # Allow calling for help via:
        #   inventory command help
        #   inventory command -h
        #   inventory command --help
        #   inventory command -D
        #
        # as well thor's normal way:
        #
        #   inventory 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

5 entries across 5 versions & 1 rubygems

Version Path
aws-inventory-0.3.2 lib/inventory/command.rb
aws-inventory-0.3.1 lib/inventory/command.rb
aws-inventory-0.3.0 lib/inventory/command.rb
aws-inventory-0.2.1 lib/inventory/command.rb
aws-inventory-0.2.0 lib/inventory/command.rb