Sha256: 04d186e36edbc369ab71ddd42bc6117118286f1234e82877147011a407e0bea6

Contents?: true

Size: 601 Bytes

Versions: 3

Compression:

Stored size: 601 Bytes

Contents

require "thor"

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

3 entries across 3 versions & 1 rubygems

Version Path
aws-ec2-0.3.0 lib/aws_ec2/command.rb
aws-ec2-0.2.0 lib/aws_ec2/command.rb
aws-ec2-0.1.0 lib/aws_ec2/command.rb