mirror of https://github.com/docker/cli.git
Merge pull request #3973 from thaJeztah/no_escape
cli: additionalHelp() don't decorate output if it's piped, and add extra newline
This commit is contained in:
commit
fe694e8219
|
@ -234,9 +234,13 @@ func isExperimental(cmd *cobra.Command) bool {
|
|||
}
|
||||
|
||||
func additionalHelp(cmd *cobra.Command) string {
|
||||
if additionalHelp, ok := cmd.Annotations["additionalHelp"]; ok {
|
||||
if msg, ok := cmd.Annotations["additionalHelp"]; ok {
|
||||
out := cmd.OutOrStderr()
|
||||
if _, isTerminal := term.GetFdInfo(out); !isTerminal {
|
||||
return msg
|
||||
}
|
||||
style := aec.EmptyBuilder.Bold().ANSI
|
||||
return style.Apply(additionalHelp)
|
||||
return style.Apply(msg)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
@ -507,6 +511,7 @@ Run '{{.CommandPath}} COMMAND --help' for more information on a command.
|
|||
{{- if hasAdditionalHelp .}}
|
||||
|
||||
{{ additionalHelp . }}
|
||||
|
||||
{{- end}}
|
||||
`
|
||||
|
||||
|
|
Loading…
Reference in New Issue