Skip to content

Commit 7d56538

Browse files
committed
test: add root flags for tests
Adds a hidden --help flag (like in docker/cli) and a dummy -H flag Signed-off-by: David Karlsson <[email protected]>
1 parent 7142e86 commit 7d56538

16 files changed

+97
-30
lines changed

clidocstool_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ func setup() {
5454
DisableFlagsInUseLine: true,
5555
}
5656

57+
dockerCmd.PersistentFlags().BoolP("help", "h", false, "Print usage")
58+
dockerCmd.PersistentFlags().MarkShorthandDeprecated("help", "please use --help")
59+
dockerCmd.PersistentFlags().Lookup("help").Hidden = true
60+
dockerCmd.Flags().StringP("host", "H", "unix:///var/run/docker.sock", "Daemon socket to connect to")
61+
5762
attachCmd = &cobra.Command{
5863
Use: "attach [OPTIONS] CONTAINER",
5964
Short: "Attach local standard input, output, and error streams to a running container",

fixtures/docker-attach.1

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ Attach local standard input, output, and error streams to a running container
2121
\fB--detach-keys\fP=""
2222
Override the key sequence for detaching a container
2323

24-
.PP
25-
\fB-h\fP, \fB--help\fP[=false]
26-
help for attach
27-
2824
.PP
2925
\fB--no-stdin\fP[=false]
3026
Do not attach STDIN

fixtures/docker-buildx-build.1

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ Start a build
4949
\fB-f\fP, \fB--file\fP=""
5050
Name of the Dockerfile (default: "PATH/Dockerfile")
5151

52-
.PP
53-
\fB-h\fP, \fB--help\fP[=false]
54-
help for build
55-
5652
.PP
5753
\fB--iidfile\fP=""
5854
Write the image ID to the file

fixtures/docker-buildx-dial-stdio.1

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ Proxy current stdio streams to builder instance
1717

1818

1919
.SH OPTIONS
20-
.PP
21-
\fB-h\fP, \fB--help\fP[=false]
22-
help for dial-stdio
23-
2420
.PP
2521
\fB--platform\fP=""
2622
Target platform: this is used for node selection

fixtures/docker-buildx-install.1

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ docker-buildx-install - Install buildx as a 'docker builder' alias
1616
Install buildx as a 'docker builder' alias
1717

1818

19-
.SH OPTIONS
20-
.PP
21-
\fB-h\fP, \fB--help\fP[=false]
22-
help for install
23-
24-
2519
.SH OPTIONS INHERITED FROM PARENT COMMANDS
2620
.PP
2721
\fB--builder\fP=""

fixtures/docker-buildx-stop.1

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ docker-buildx-stop - Stop builder instance
1616
Stop builder instance
1717

1818

19-
.SH OPTIONS
20-
.PP
21-
\fB-h\fP, \fB--help\fP[=false]
22-
help for stop
23-
24-
2519
.SH OPTIONS INHERITED FROM PARENT COMMANDS
2620
.PP
2721
\fB--builder\fP=""

fixtures/docker-buildx.1

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ Extended build capabilities with BuildKit
2121
\fB--builder\fP=""
2222
Override the configured builder instance
2323

24-
.PP
25-
\fB-h\fP, \fB--help\fP[=false]
26-
help for buildx
27-
2824

2925
.SH SEE ALSO
3026
.PP

fixtures/docker.1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ A self-sufficient runtime for containers
1818

1919
.SH OPTIONS
2020
.PP
21-
\fB-h\fP, \fB--help\fP[=false]
22-
help for docker
21+
\fB-H\fP, \fB--host\fP="unix:///var/run/docker.sock"
22+
Daemon socket to connect to
2323

2424

2525
.SH SEE ALSO

fixtures/docker.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ A self-sufficient runtime for containers
1111
| [`buildx`](buildx.md) | Docker Buildx |
1212

1313

14+
### Options
15+
16+
| Name | Type | Default | Description |
17+
|:---------------|:---------|:------------------------------|:----------------------------|
18+
| `-H`, `--host` | `string` | `unix:///var/run/docker.sock` | Daemon socket to connect to |
19+
1420

1521
<!---MARKER_GEN_END-->
1622

fixtures/docker.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,28 @@ cname:
88
clink:
99
- docker_attach.yaml
1010
- docker_buildx.yaml
11+
options:
12+
- option: help
13+
value_type: bool
14+
default_value: "false"
15+
description: Print usage
16+
deprecated: false
17+
hidden: true
18+
experimental: false
19+
experimentalcli: false
20+
kubernetes: false
21+
swarm: false
22+
- option: host
23+
shorthand: H
24+
value_type: string
25+
default_value: unix:///var/run/docker.sock
26+
description: Daemon socket to connect to
27+
deprecated: false
28+
hidden: false
29+
experimental: false
30+
experimentalcli: false
31+
kubernetes: false
32+
swarm: false
1133
deprecated: false
1234
hidden: false
1335
experimental: false

0 commit comments

Comments
 (0)