From 7f3717bd2aaaab3d3f7e0d276db9d1fe396cfe74 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 2 Oct 2020 15:41:17 +0200 Subject: [PATCH] Replace tab with spaces in usage output 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 --- cli/cobra.go | 4 ++-- e2e/cli-plugins/run_test.go | 4 ++-- .../testdata/docker-help-helloworld-goodbye.golden | 2 +- e2e/cli-plugins/testdata/docker-help-helloworld.golden | 2 +- e2e/stack/testdata/stack-deploy-help-kubernetes.golden | 2 +- e2e/stack/testdata/stack-deploy-help-swarm.golden | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cli/cobra.go b/cli/cobra.go index 93a6f661bd..4804d74f2d 100644 --- a/cli/cobra.go +++ b/cli/cobra.go @@ -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}} diff --git a/e2e/cli-plugins/run_test.go b/e2e/cli-plugins/run_test.go index 3042044f22..e3290b81fa 100644 --- a/e2e/cli-plugins/run_test.go +++ b/e2e/cli-plugins/run_test.go @@ -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 @@ -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 diff --git a/e2e/cli-plugins/testdata/docker-help-helloworld-goodbye.golden b/e2e/cli-plugins/testdata/docker-help-helloworld-goodbye.golden index d789f7997f..b683120cf3 100644 --- a/e2e/cli-plugins/testdata/docker-help-helloworld-goodbye.golden +++ b/e2e/cli-plugins/testdata/docker-help-helloworld-goodbye.golden @@ -1,4 +1,4 @@ -Usage: docker helloworld goodbye +Usage: docker helloworld goodbye Say Goodbye instead of Hello diff --git a/e2e/cli-plugins/testdata/docker-help-helloworld.golden b/e2e/cli-plugins/testdata/docker-help-helloworld.golden index 9d2f6673ee..bea200b142 100644 --- a/e2e/cli-plugins/testdata/docker-help-helloworld.golden +++ b/e2e/cli-plugins/testdata/docker-help-helloworld.golden @@ -1,5 +1,5 @@ -Usage: docker helloworld [OPTIONS] COMMAND +Usage: docker helloworld [OPTIONS] COMMAND A basic Hello World plugin for tests diff --git a/e2e/stack/testdata/stack-deploy-help-kubernetes.golden b/e2e/stack/testdata/stack-deploy-help-kubernetes.golden index a0d6080a11..e3f8e30f56 100644 --- a/e2e/stack/testdata/stack-deploy-help-kubernetes.golden +++ b/e2e/stack/testdata/stack-deploy-help-kubernetes.golden @@ -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 diff --git a/e2e/stack/testdata/stack-deploy-help-swarm.golden b/e2e/stack/testdata/stack-deploy-help-swarm.golden index 19ee3676d0..f21c5d316e 100644 --- a/e2e/stack/testdata/stack-deploy-help-swarm.golden +++ b/e2e/stack/testdata/stack-deploy-help-swarm.golden @@ -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