Sha256: 651e66a0b963875cbfc89183a5ca24b931d7222fa6b25a6f32bfe66080defcc0

Contents?: true

Size: 900 Bytes

Versions: 12

Compression:

Stored size: 900 Bytes

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 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

12 entries across 12 versions & 1 rubygems

Version Path
aws-ec2-0.9.0 lib/aws_ec2/command.rb
aws-ec2-0.8.4 lib/aws_ec2/command.rb
aws-ec2-0.8.3 lib/aws_ec2/command.rb
aws-ec2-0.8.2 lib/aws_ec2/command.rb
aws-ec2-0.8.1 lib/aws_ec2/command.rb
aws-ec2-0.8.0 lib/aws_ec2/command.rb
aws-ec2-0.7.0 lib/aws_ec2/command.rb
aws-ec2-0.6.0 lib/aws_ec2/command.rb
aws-ec2-0.5.2 lib/aws_ec2/command.rb
aws-ec2-0.5.1 lib/aws_ec2/command.rb
aws-ec2-0.5.0 lib/aws_ec2/command.rb
aws-ec2-0.4.0 lib/aws_ec2/command.rb