Skip to content

[v2] Reduce invalid choice output #9457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2025

Conversation

hssyoo
Copy link
Contributor

@hssyoo hssyoo commented Apr 23, 2025

Currently, if a user supplies an invalid choice in a command, the error output contains all possible values (eg all service commands). This output is noisy, especially for developers who use screen readers. This PR reduces noise by removing all possible suggestions, keeping only suggestions that are similar to the supplied invalid choice.

Example:

> aws s3api hello-world

aws: error: argument operation: Found invalid choice 'hello-world'


usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

Example with suggestion:

> aws s3api get-objeck

aws: error: argument operation: Found invalid choice 'get-objeck'

Maybe you meant:

  * get-object

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

@hssyoo hssyoo requested a review from kdaily April 23, 2025 19:02
@hssyoo hssyoo changed the title Reduce invalid choice output [v2] Reduce invalid choice output Apr 23, 2025
@kdaily kdaily changed the base branch from v2 to cli-accessibility April 29, 2025 17:54
@kdaily kdaily merged commit 74fadaa into aws:cli-accessibility May 2, 2025
59 of 60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants