Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes
This implementation is a proof of concept. Implementation details, interfaces, and behavior are subject to breaking changes.
Initial implementation to add in a configuration option that can open CLI help pages in the browser or print the URL to the remote CLI reference guide.
The new configuration option is available in the shared configuration file as
cli_help_output
. It has four valid values:terminal
: default behavior opening the man page in the terminal.browser
: open the man page as HTML in the default browser.url
: print the URL to the remote AWS CLI reference guide for the version of the AWS CLI installed.When set to
browser
, a warning message is printed to the terminal notifying the user that the default web browser is being opened, and an error message in the case the browser cannot be opened.When set to
url
, the value for client side paging is respected (e.g., controlled throughAWS_PAGER
environment variable).Implementation notes
This refactors the existing help renderer to move the previous parent class
PagingHelpRenderer
to a sub-class of aHelpRenderer
. It refactors to potentially send output to different destinations, currently a pager or a browser.Then, this adds a new renderer base class called the
BrowserHelpRenderer
that swaps out a private method that sends rendered output to the pager with one that sends it to the browser. The rendered content is written to a temporary file and then the users default browser is opened. Separate OS-specific renders inherit, as the paging-based renderers did. An OS-specific sub-class is added that uses this behavior (PosixBrowserHelpRenderer
) to render the output usinggroff
ormandoc
usinghtml
instead ofascii
output, and aWindowsBrowserHelpRenderer
swaps out the text writer for an HTML writer.Help command classes (derived from
HelpCommand
) now have aurl
property. Additionally, theHelpCommand
now uses its own botocore session to determine if its help should be the documentation contents or the URL.TODO:
HelpCommand
to control behavior of text documentation or the URL.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.