-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include global options in command docs
We get a lot of requests from users to include global options in a command's help page. This PR fulfils them by pre-generating .rst files for global options and synopsis and writing them to commands' help docs. An alternative that was considered attempted to plumb the global arg table from the CLIDriver to any help command that would need it. However, we abandoned the approach because it was too invasive to the existing interfaces and there was no easy way to apply the changes to customizations.
- Loading branch information
Showing
12 changed files
with
322 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"type": "enhancement", | ||
"category": "docs", | ||
"description": "Improve AWS CLI docs to include global options available to service commands." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
``--debug`` (boolean) | ||
|
||
Turn on debug logging. | ||
|
||
``--endpoint-url`` (string) | ||
|
||
Override command's default URL with the given URL. | ||
|
||
``--no-verify-ssl`` (boolean) | ||
|
||
By default, the AWS CLI uses SSL when communicating with AWS services. For each SSL connection, the AWS CLI will verify SSL certificates. This option overrides the default behavior of verifying SSL certificates. | ||
|
||
``--no-paginate`` (boolean) | ||
|
||
Disable automatic pagination. | ||
|
||
``--output`` (string) | ||
|
||
The formatting style for command output. | ||
|
||
|
||
* json | ||
|
||
* text | ||
|
||
* table | ||
|
||
|
||
``--query`` (string) | ||
|
||
A JMESPath query to use in filtering the response data. | ||
|
||
``--profile`` (string) | ||
|
||
Use a specific profile from your credential file. | ||
|
||
``--region`` (string) | ||
|
||
The region to use. Overrides config/env settings. | ||
|
||
``--version`` (string) | ||
|
||
Display the version of this tool. | ||
|
||
``--color`` (string) | ||
|
||
Turn on/off color output. | ||
|
||
|
||
* on | ||
|
||
* off | ||
|
||
* auto | ||
|
||
|
||
``--no-sign-request`` (boolean) | ||
|
||
Do not sign requests. Credentials will not be loaded if this argument is provided. | ||
|
||
``--ca-bundle`` (string) | ||
|
||
The CA certificate bundle to use when verifying SSL certificates. Overrides config/env settings. | ||
|
||
``--cli-read-timeout`` (int) | ||
|
||
The maximum socket read time in seconds. If the value is set to 0, the socket read will be blocking and not timeout. The default value is 60 seconds. | ||
|
||
``--cli-connect-timeout`` (int) | ||
|
||
The maximum socket connect time in seconds. If the value is set to 0, the socket connect will be blocking and not timeout. The default value is 60 seconds. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[--debug] | ||
[--endpoint-url <value>] | ||
[--no-verify-ssl] | ||
[--no-paginate] | ||
[--output <value>] | ||
[--query <value>] | ||
[--profile <value>] | ||
[--region <value>] | ||
[--version <value>] | ||
[--color <value>] | ||
[--no-sign-request] | ||
[--ca-bundle <value>] | ||
[--cli-read-timeout <value>] | ||
[--cli-connect-timeout <value>] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env python | ||
"""Generate a global options section. | ||
The purpose of this script is to pre-generate | ||
global options for the help docs. | ||
The output of this script is loaded and applied to | ||
every subcommand's help docs. | ||
""" | ||
|
||
import os | ||
|
||
from awscli.clidriver import create_clidriver | ||
from awscli.clidocs import ( | ||
EXAMPLES_DIR, GLOBAL_OPTIONS_FILE, | ||
GLOBAL_OPTIONS_SYNOPSIS_FILE, GlobalOptionsDocumenter | ||
) | ||
|
||
|
||
def main(): | ||
if not os.path.isdir(EXAMPLES_DIR): | ||
os.makedirs(EXAMPLES_DIR) | ||
driver = create_clidriver() | ||
options_help_command = driver.create_help_command() | ||
synopsis_help_command = driver.create_help_command() | ||
options_documenter = GlobalOptionsDocumenter(options_help_command) | ||
synopsis_documenter = GlobalOptionsDocumenter(synopsis_help_command) | ||
|
||
with open(GLOBAL_OPTIONS_FILE, 'w') as f: | ||
for line in options_documenter.doc_global_options(): | ||
f.write(line) | ||
with open(GLOBAL_OPTIONS_SYNOPSIS_FILE, 'w') as f: | ||
for line in synopsis_documenter.doc_global_synopsis(): | ||
f.write(line) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.