From 7f3717bd2aaaab3d3f7e0d276db9d1fe396cfe74 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 2 Oct 2020 15:41:17 +0200 Subject: [PATCH 1/2] 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 From e6ef3349f603f284f5bdb3dd034db0fa849a360a Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 2 Oct 2020 15:51:01 +0200 Subject: [PATCH 2/2] update docs usage output to match new format Signed-off-by: Sebastiaan van Stijn --- docs/reference/commandline/container_prune.md | 2 +- docs/reference/commandline/image_prune.md | 2 +- docs/reference/commandline/network_create.md | 2 +- docs/reference/commandline/network_prune.md | 2 +- docs/reference/commandline/node_rm.md | 2 +- docs/reference/commandline/plugin_inspect.md | 2 +- docs/reference/commandline/plugin_push.md | 2 +- docs/reference/commandline/secret_create.md | 2 +- docs/reference/commandline/secret_ls.md | 2 +- docs/reference/commandline/secret_rm.md | 2 +- docs/reference/commandline/service_ls.md | 2 +- docs/reference/commandline/service_rm.md | 2 +- docs/reference/commandline/service_rollback.md | 2 +- docs/reference/commandline/stack_ls.md | 2 +- docs/reference/commandline/stack_services.md | 2 +- docs/reference/commandline/swarm_ca.md | 2 +- docs/reference/commandline/swarm_join-token.md | 2 +- docs/reference/commandline/swarm_leave.md | 2 +- docs/reference/commandline/swarm_unlock-key.md | 2 +- docs/reference/commandline/swarm_unlock.md | 2 +- docs/reference/commandline/system_df.md | 2 +- docs/reference/commandline/system_prune.md | 2 +- docs/reference/commandline/trust_key_load.md | 2 +- docs/reference/commandline/trust_signer_add.md | 2 +- docs/reference/commandline/trust_signer_remove.md | 2 +- docs/reference/commandline/volume_prune.md | 2 +- 26 files changed, 26 insertions(+), 26 deletions(-) diff --git a/docs/reference/commandline/container_prune.md b/docs/reference/commandline/container_prune.md index 23eb6b01bf..9426939ee9 100644 --- a/docs/reference/commandline/container_prune.md +++ b/docs/reference/commandline/container_prune.md @@ -7,7 +7,7 @@ keywords: container, prune, delete, remove # container prune ```markdown -Usage: docker container prune [OPTIONS] +Usage: docker container prune [OPTIONS] Remove all stopped containers diff --git a/docs/reference/commandline/image_prune.md b/docs/reference/commandline/image_prune.md index daea4c7021..ac75051791 100644 --- a/docs/reference/commandline/image_prune.md +++ b/docs/reference/commandline/image_prune.md @@ -7,7 +7,7 @@ keywords: "image, prune, delete, remove" # image prune ```markdown -Usage: docker image prune [OPTIONS] +Usage: docker image prune [OPTIONS] Remove unused images diff --git a/docs/reference/commandline/network_create.md b/docs/reference/commandline/network_create.md index eff8160172..a7e22a799e 100644 --- a/docs/reference/commandline/network_create.md +++ b/docs/reference/commandline/network_create.md @@ -7,7 +7,7 @@ keywords: "network, create" # network create ```markdown -Usage: docker network create [OPTIONS] NETWORK +Usage: docker network create [OPTIONS] NETWORK Create a network diff --git a/docs/reference/commandline/network_prune.md b/docs/reference/commandline/network_prune.md index 0bbb74a28b..c49ff5f0a8 100644 --- a/docs/reference/commandline/network_prune.md +++ b/docs/reference/commandline/network_prune.md @@ -7,7 +7,7 @@ keywords: "network, prune, delete" # network prune ```markdown -Usage: docker network prune [OPTIONS] +Usage: docker network prune [OPTIONS] Remove all unused networks diff --git a/docs/reference/commandline/node_rm.md b/docs/reference/commandline/node_rm.md index d64dd80db8..53cd309eeb 100644 --- a/docs/reference/commandline/node_rm.md +++ b/docs/reference/commandline/node_rm.md @@ -7,7 +7,7 @@ keywords: "node, remove" # node rm ```markdown -Usage: docker node rm [OPTIONS] NODE [NODE...] +Usage: docker node rm [OPTIONS] NODE [NODE...] Remove one or more nodes from the swarm diff --git a/docs/reference/commandline/plugin_inspect.md b/docs/reference/commandline/plugin_inspect.md index 63fbde3af2..ab8679b7ac 100644 --- a/docs/reference/commandline/plugin_inspect.md +++ b/docs/reference/commandline/plugin_inspect.md @@ -7,7 +7,7 @@ keywords: "plugin, inspect" # plugin inspect ```markdown -Usage: docker plugin inspect [OPTIONS] PLUGIN [PLUGIN...] +Usage: docker plugin inspect [OPTIONS] PLUGIN [PLUGIN...] Display detailed information on one or more plugins diff --git a/docs/reference/commandline/plugin_push.md b/docs/reference/commandline/plugin_push.md index 02e862026b..c554a747fd 100644 --- a/docs/reference/commandline/plugin_push.md +++ b/docs/reference/commandline/plugin_push.md @@ -5,7 +5,7 @@ keywords: "plugin, push" --- ```markdown -Usage: docker plugin push [OPTIONS] PLUGIN[:TAG] +Usage: docker plugin push [OPTIONS] PLUGIN[:TAG] Push a plugin to a registry diff --git a/docs/reference/commandline/secret_create.md b/docs/reference/commandline/secret_create.md index 2b1c360139..0c131b8a29 100644 --- a/docs/reference/commandline/secret_create.md +++ b/docs/reference/commandline/secret_create.md @@ -7,7 +7,7 @@ keywords: ["secret, create"] # secret create ```Markdown -Usage: docker secret create [OPTIONS] SECRET [file|-] +Usage: docker secret create [OPTIONS] SECRET [file|-] Create a secret from a file or STDIN as content diff --git a/docs/reference/commandline/secret_ls.md b/docs/reference/commandline/secret_ls.md index 8e8b086b9e..45519b1ca8 100644 --- a/docs/reference/commandline/secret_ls.md +++ b/docs/reference/commandline/secret_ls.md @@ -7,7 +7,7 @@ keywords: ["secret, ls"] # secret ls ```Markdown -Usage: docker secret ls [OPTIONS] +Usage: docker secret ls [OPTIONS] List secrets diff --git a/docs/reference/commandline/secret_rm.md b/docs/reference/commandline/secret_rm.md index 62630cd6c8..96505bfc06 100644 --- a/docs/reference/commandline/secret_rm.md +++ b/docs/reference/commandline/secret_rm.md @@ -7,7 +7,7 @@ keywords: ["secret, rm"] # secret rm ```Markdown -Usage: docker secret rm SECRET [SECRET...] +Usage: docker secret rm SECRET [SECRET...] Remove one or more secrets diff --git a/docs/reference/commandline/service_ls.md b/docs/reference/commandline/service_ls.md index efe1bced17..8b9954b514 100644 --- a/docs/reference/commandline/service_ls.md +++ b/docs/reference/commandline/service_ls.md @@ -7,7 +7,7 @@ keywords: "service, ls" # service ls ```Markdown -Usage: docker service ls [OPTIONS] +Usage: docker service ls [OPTIONS] List services diff --git a/docs/reference/commandline/service_rm.md b/docs/reference/commandline/service_rm.md index ecbe0dbb32..ec8cddcb3c 100644 --- a/docs/reference/commandline/service_rm.md +++ b/docs/reference/commandline/service_rm.md @@ -7,7 +7,7 @@ keywords: "service, rm" # service rm ```Markdown -Usage: docker service rm SERVICE [SERVICE...] +Usage: docker service rm SERVICE [SERVICE...] Remove one or more services diff --git a/docs/reference/commandline/service_rollback.md b/docs/reference/commandline/service_rollback.md index bd9aaec3b2..4d8745330b 100644 --- a/docs/reference/commandline/service_rollback.md +++ b/docs/reference/commandline/service_rollback.md @@ -7,7 +7,7 @@ keywords: "service, rollback" # service rollback ```markdown -Usage: docker service rollback SERVICE +Usage: docker service rollback SERVICE Revert changes to a service's configuration diff --git a/docs/reference/commandline/stack_ls.md b/docs/reference/commandline/stack_ls.md index 08815f801e..0d7517a336 100644 --- a/docs/reference/commandline/stack_ls.md +++ b/docs/reference/commandline/stack_ls.md @@ -7,7 +7,7 @@ keywords: "stack, ls" # stack ls ```markdown -Usage: docker stack ls [OPTIONS] +Usage: docker stack ls [OPTIONS] List stacks diff --git a/docs/reference/commandline/stack_services.md b/docs/reference/commandline/stack_services.md index cbe6966797..a3ee74335b 100644 --- a/docs/reference/commandline/stack_services.md +++ b/docs/reference/commandline/stack_services.md @@ -7,7 +7,7 @@ keywords: "stack, services" # stack services ```markdown -Usage: docker stack services [OPTIONS] STACK +Usage: docker stack services [OPTIONS] STACK List the services in the stack diff --git a/docs/reference/commandline/swarm_ca.md b/docs/reference/commandline/swarm_ca.md index 4309b62e0e..e342ce5a6c 100644 --- a/docs/reference/commandline/swarm_ca.md +++ b/docs/reference/commandline/swarm_ca.md @@ -7,7 +7,7 @@ keywords: "swarm, ca" # swarm ca ```markdown -Usage: docker swarm ca [OPTIONS] +Usage: docker swarm ca [OPTIONS] Manage root CA diff --git a/docs/reference/commandline/swarm_join-token.md b/docs/reference/commandline/swarm_join-token.md index 98c5a16c1d..fd85af7e02 100644 --- a/docs/reference/commandline/swarm_join-token.md +++ b/docs/reference/commandline/swarm_join-token.md @@ -7,7 +7,7 @@ keywords: "swarm, join-token" # swarm join-token ```markdown -Usage: docker swarm join-token [OPTIONS] (worker|manager) +Usage: docker swarm join-token [OPTIONS] (worker|manager) Manage join tokens diff --git a/docs/reference/commandline/swarm_leave.md b/docs/reference/commandline/swarm_leave.md index 548f63e342..0d1e845478 100644 --- a/docs/reference/commandline/swarm_leave.md +++ b/docs/reference/commandline/swarm_leave.md @@ -7,7 +7,7 @@ keywords: "swarm, leave" # swarm leave ```markdown -Usage: docker swarm leave [OPTIONS] +Usage: docker swarm leave [OPTIONS] Leave the swarm diff --git a/docs/reference/commandline/swarm_unlock-key.md b/docs/reference/commandline/swarm_unlock-key.md index 79c65b4e3d..0d191dfb67 100644 --- a/docs/reference/commandline/swarm_unlock-key.md +++ b/docs/reference/commandline/swarm_unlock-key.md @@ -7,7 +7,7 @@ keywords: "swarm, unlock-key" # swarm unlock-key ```markdown -Usage: docker swarm unlock-key [OPTIONS] +Usage: docker swarm unlock-key [OPTIONS] Manage the unlock key diff --git a/docs/reference/commandline/swarm_unlock.md b/docs/reference/commandline/swarm_unlock.md index ea0026fbe8..dbcde50c71 100644 --- a/docs/reference/commandline/swarm_unlock.md +++ b/docs/reference/commandline/swarm_unlock.md @@ -7,7 +7,7 @@ keywords: "swarm, unlock" # swarm unlock ```markdown -Usage: docker swarm unlock +Usage: docker swarm unlock Unlock swarm diff --git a/docs/reference/commandline/system_df.md b/docs/reference/commandline/system_df.md index 92e070bef0..015585ab91 100644 --- a/docs/reference/commandline/system_df.md +++ b/docs/reference/commandline/system_df.md @@ -7,7 +7,7 @@ keywords: "system, data, usage, disk" # system df ```markdown -Usage: docker system df [OPTIONS] +Usage: docker system df [OPTIONS] Show docker filesystem usage diff --git a/docs/reference/commandline/system_prune.md b/docs/reference/commandline/system_prune.md index 67f01b596e..7cbd04dde4 100644 --- a/docs/reference/commandline/system_prune.md +++ b/docs/reference/commandline/system_prune.md @@ -7,7 +7,7 @@ keywords: "system, prune, delete, remove" # system prune ```markdown -Usage: docker system prune [OPTIONS] +Usage: docker system prune [OPTIONS] Remove unused data diff --git a/docs/reference/commandline/trust_key_load.md b/docs/reference/commandline/trust_key_load.md index f14c9e1eb9..2d5280a158 100644 --- a/docs/reference/commandline/trust_key_load.md +++ b/docs/reference/commandline/trust_key_load.md @@ -7,7 +7,7 @@ keywords: "key, notary, trust" # trust key load ```markdown -Usage: docker trust key load [OPTIONS] KEYFILE +Usage: docker trust key load [OPTIONS] KEYFILE Load a private key file for signing diff --git a/docs/reference/commandline/trust_signer_add.md b/docs/reference/commandline/trust_signer_add.md index e3c6f928ab..71c7197cc0 100644 --- a/docs/reference/commandline/trust_signer_add.md +++ b/docs/reference/commandline/trust_signer_add.md @@ -7,7 +7,7 @@ keywords: "signer, notary, trust" # trust signer add ```markdown -Usage: docker trust signer add [OPTIONS] NAME REPOSITORY [REPOSITORY...] +Usage: docker trust signer add [OPTIONS] NAME REPOSITORY [REPOSITORY...] Add a signer diff --git a/docs/reference/commandline/trust_signer_remove.md b/docs/reference/commandline/trust_signer_remove.md index 2e197d56d2..55a2c65a7e 100644 --- a/docs/reference/commandline/trust_signer_remove.md +++ b/docs/reference/commandline/trust_signer_remove.md @@ -7,7 +7,7 @@ keywords: "signer, notary, trust" # trust signer remove ```markdown -Usage: docker trust signer remove [OPTIONS] NAME REPOSITORY [REPOSITORY...] +Usage: docker trust signer remove [OPTIONS] NAME REPOSITORY [REPOSITORY...] Remove a signer diff --git a/docs/reference/commandline/volume_prune.md b/docs/reference/commandline/volume_prune.md index 9906d60b12..074f3d1c80 100644 --- a/docs/reference/commandline/volume_prune.md +++ b/docs/reference/commandline/volume_prune.md @@ -7,7 +7,7 @@ keywords: "volume, prune, delete" # volume prune ```markdown -Usage: docker volume prune [OPTIONS] +Usage: docker volume prune [OPTIONS] Remove all unused local volumes