[20.10 backport] cli: additionalHelp() don't decorate output if it's piped, and add extra newline #3976
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.
Relates to:
cli: additionalHelp() don't decorate output if it's piped
This prevents the escape-characters being included when piping the
output, e.g.
docker --help > output.txt
, ordocker --help | something
.These control-characters could cause issues if users copy/pasted the URL
from the output, resulting in them becoming part of the URL they tried
to visit, which would fail, e.g. when copying the output from:
Users ended up on URLs like;
Before this patch, control characters ("bold") would be printed, even if
no TTY was attached;
With this patch, no control characters are included:
Add extra newline after additionalHelp output
The additionalHelp message is printed at the end of the --help output;
As this message may contain an URL, users may copy/paste the URL to open it
in their browser, but can easily end up copying their prompt (as there's
no whitespace after it), and as a result end up on a broken URL, for example:
This patch adds an extra newline at the end to provide some whitespace
around the message, making it less error-prone to copy the URL;
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)