-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Description
Describe the feature
Currently, if you were to type an invalid subcommand, you get back a list of valid subcommands
$ aws ec2 in
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: argument operation: Invalid choice, valid choices are:
accept-address-transfer | accept-reserved-instances-exchange-quote
accept-transit-gateway-multicast-domain-associations | accept-transit-gateway-peering-attachment
[...]
This list actually includes custom aliases defined in ~/.aws/cli/alias
$ aws ec2 in
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: argument operation: Invalid choice, valid choices are:
accept-address-transfer | accept-reserved-instances-exchange-quote
accept-transit-gateway-multicast-domain-associations | accept-transit-gateway-peering-attachment
accept-transit-gateway-vpc-attachment | accept-vpc-endpoint-connections
[....]
withdraw-byoip-cidr | wait
instances-running-table | instances-stopped-table
instances-status | help
$
However, aws_autocomplete
does not seem to have available the aliases to be auto completed. The below command does not display any of the instances-*
commands as shown in the error message above.
$ aws ec2 in<tab>
The aws_completer
command doesn't include the alias in it's results
$ COMP_LINE="aws ec2 i" aws_completer
import-client-vpn-client-certificate-revocation-list
import-image
import-key-pair
import-snapshot
$
Use Case
It is much faster to use autocomplete to complete long commands as well as to remind oneself of what commands exist based on a known prefix. This should include custom aliases which are created in the ~/.aws/cli/alias
file.
Proposed Solution
Make sure the same method of building the list of available subcommands in error messages is used by aws_completer
to build available command and subcommand choices including aliases from ~/.aws/cli/alias
.
Other Information
No response
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
CLI version used
aws-cli/2.17.32 Python/3.11.9 Linux/6.11.0-21-generic exe/x86_64.ubuntu.24
Environment details (OS name and version, etc.)
Ubuntu 24.04.2 LTS