Skip to content

Commit

Permalink
Replace tab with spaces in usage output
Browse files Browse the repository at this point in the history
All output of the usage / --help output uses spaces, and having a tab
in the output can be somewhat cumbersome (e.g. our YAML docs generator
doesn't like them, and copy/pasing the output in iTerm produces a warning).

This patch changes the output to use two spaces instead.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Oct 2, 2020
1 parent 9b92be0 commit 7f3717b
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cli/cobra.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ func invalidPluginReason(cmd *cobra.Command) string {

var usageTemplate = `Usage:
{{- if not .HasSubCommands}} {{.UseLine}}{{end}}
{{- if .HasSubCommands}} {{ .CommandPath}}{{- if .HasAvailableFlags}} [OPTIONS]{{end}} COMMAND{{end}}
{{- if not .HasSubCommands}} {{.UseLine}}{{end}}
{{- if .HasSubCommands}} {{ .CommandPath}}{{- if .HasAvailableFlags}} [OPTIONS]{{end}} COMMAND{{end}}
{{if ne .Long ""}}{{ .Long | trim }}{{ else }}{{ .Short | trim }}{{end}}
Expand Down
4 changes: 2 additions & 2 deletions e2e/cli-plugins/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestNonexistingHelp(t *testing.T) {
// This should actually be the whole docker help
// output, so spot check instead having of a golden
// with everything in, which will change too frequently.
Out: "Usage: docker [OPTIONS] COMMAND\n\nA self-sufficient runtime for containers",
Out: "Usage: docker [OPTIONS] COMMAND\n\nA self-sufficient runtime for containers",
Err: icmd.None,
})
// Short -h should be the same, modulo the deprecation message
Expand Down Expand Up @@ -101,7 +101,7 @@ func TestBadHelp(t *testing.T) {
// This should be literally the whole docker help
// output, so spot check instead of a golden with
// everything in which will change all the time.
Out: "Usage: docker [OPTIONS] COMMAND\n\nA self-sufficient runtime for containers",
Out: "Usage: docker [OPTIONS] COMMAND\n\nA self-sufficient runtime for containers",
Err: icmd.None,
})
// Short -h should be the same, modulo the deprecation message
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

Usage: docker helloworld goodbye
Usage: docker helloworld goodbye

Say Goodbye instead of Hello
2 changes: 1 addition & 1 deletion e2e/cli-plugins/testdata/docker-help-helloworld.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Usage: docker helloworld [OPTIONS] COMMAND
Usage: docker helloworld [OPTIONS] COMMAND

A basic Hello World plugin for tests

Expand Down
2 changes: 1 addition & 1 deletion e2e/stack/testdata/stack-deploy-help-kubernetes.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Usage: docker stack deploy [OPTIONS] STACK
Usage: docker stack deploy [OPTIONS] STACK

Deploy a new stack or update an existing stack

Expand Down
2 changes: 1 addition & 1 deletion e2e/stack/testdata/stack-deploy-help-swarm.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Usage: docker stack deploy [OPTIONS] STACK
Usage: docker stack deploy [OPTIONS] STACK

Deploy a new stack or update an existing stack

Expand Down

0 comments on commit 7f3717b

Please sign in to comment.