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