Sha256: 06002494a919212490a2016a741e2c0d1e878a780102c1d6b57d3f697199bebc

Contents?: true

Size: 637 Bytes

Versions: 4

Compression:

Stored size: 637 Bytes

Contents

require "thor"

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

4 entries across 4 versions & 1 rubygems

Version Path
aws-inventory-0.4.5 lib/aws_inventory/command.rb
aws-inventory-0.4.3 lib/aws_inventory/command.rb
aws-inventory-0.4.2 lib/aws_inventory/command.rb
aws-inventory-0.4.0 lib/aws_inventory/command.rb