Skip to content

[v2] Adjust format of table for accessibility #9547

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

Open
wants to merge 13 commits into
base: cli-accessibility
Choose a base branch
from
Open
17 changes: 4 additions & 13 deletions awscli/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ def choices(self, val):
class CLIArgParser(argparse.ArgumentParser):
Formatter = argparse.RawTextHelpFormatter

# When displaying invalid choice error messages,
# this controls how many options to show per line.
ChoicesPerLine = 2

def _check_value(self, action, value):
"""
It's probably not a great idea to override a "hidden" method
Expand All @@ -77,15 +73,10 @@ def _check_value(self, action, value):
"""
# converted value must be one of the choices (if specified)
if action.choices is not None and value not in action.choices:
msg = ['Invalid choice, valid choices are:\n']
for i in range(len(action.choices))[:: self.ChoicesPerLine]:
current = []
for choice in action.choices[i : i + self.ChoicesPerLine]:
current.append('%-40s' % choice)
msg.append(' | '.join(current))
msg = [f"Found invalid choice '{value}'\n"]
possible = get_close_matches(value, action.choices, cutoff=0.8)
if possible:
extra = ['\n\nInvalid choice: %r, maybe you meant:\n' % value]
extra = ['Maybe you meant:\n']
for word in possible:
extra.append(' * %s' % word)
msg.extend(extra)
Expand Down Expand Up @@ -126,8 +117,8 @@ def error(self, message):
should raise an exception.
"""
usage_message = self.format_usage()
error_message = f'{self.prog}: error: {message}\n'
raise ArgParseException(f'{usage_message}\n{error_message}')
error_message = f'{self.prog}: error: {message}'
raise ArgParseException(f'{error_message}\n\n{usage_message}')


class MainArgParser(CLIArgParser):
Expand Down
1 change: 1 addition & 0 deletions awscli/botocore/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class Shape:
'contextParam',
'clientContextParams',
'requiresLength',
'pattern',
]
MAP_TYPE = OrderedDict

Expand Down
Loading
Loading