diff --git a/clidocstool_man_test.go b/clidocstool_man_test.go index 7c58860..336edf7 100644 --- a/clidocstool_man_test.go +++ b/clidocstool_man_test.go @@ -41,7 +41,7 @@ func TestGenManTree(t *testing.T) { require.NoError(t, copyFile(path.Join("fixtures", "buildx_stop.pre.md"), path.Join(tmpdir, "buildx_stop.md"))) c, err := New(Options{ - Root: buildxCmd, + Root: dockerCmd, SourceDir: tmpdir, Plugin: true, ManHeader: &doc.GenManHeader{ @@ -52,7 +52,7 @@ func TestGenManTree(t *testing.T) { }, }) require.NoError(t, err) - require.NoError(t, c.GenManTree(buildxCmd)) + require.NoError(t, c.GenManTree(dockerCmd)) seen := make(map[string]struct{}) remanpage := regexp.MustCompile(`\.\d+$`) diff --git a/clidocstool_md_test.go b/clidocstool_md_test.go index 649248b..0900b51 100644 --- a/clidocstool_md_test.go +++ b/clidocstool_md_test.go @@ -33,12 +33,12 @@ func TestGenMarkdownTree(t *testing.T) { require.NoError(t, copyFile(path.Join("fixtures", "buildx_stop.pre.md"), path.Join(tmpdir, "buildx_stop.md"))) c, err := New(Options{ - Root: buildxCmd, + Root: dockerCmd, SourceDir: tmpdir, Plugin: true, }) require.NoError(t, err) - require.NoError(t, c.GenMarkdownTree(buildxCmd)) + require.NoError(t, c.GenMarkdownTree(dockerCmd)) seen := make(map[string]struct{}) diff --git a/clidocstool_test.go b/clidocstool_test.go index 16d3eaa..0fece8e 100644 --- a/clidocstool_test.go +++ b/clidocstool_test.go @@ -32,11 +32,13 @@ import ( ) var ( - dockerCmd *cobra.Command - buildxCmd *cobra.Command - buildxBuildCmd *cobra.Command - buildxInstallCmd *cobra.Command - buildxStopCmd *cobra.Command + dockerCmd *cobra.Command + attachCmd *cobra.Command + buildxCmd *cobra.Command + buildxBuildCmd *cobra.Command + buildxDialStdioCmd *cobra.Command + buildxInstallCmd *cobra.Command + buildxStopCmd *cobra.Command ) //nolint:errcheck @@ -51,6 +53,22 @@ func setup() { Version: "20.10.8", DisableFlagsInUseLine: true, } + + attachCmd = &cobra.Command{ + Use: "attach [OPTIONS] CONTAINER", + Short: "Attach local standard input, output, and error streams to a running container", + Annotations: map[string]string{ + "aliases": "docker container attach, docker attach", + }, + Run: func(cmd *cobra.Command, args []string) {}, + } + + attachFlags := attachCmd.Flags() + attachFlags.Bool("no-stdin", false, "Do not attach STDIN") + attachFlags.Bool("sig-proxy", true, "Proxy all received signals to the process") + attachFlags.String("detach-keys", "", "Override the key sequence for detaching a container") + dockerCmd.AddCommand(attachCmd) + buildxCmd = &cobra.Command{ Use: "buildx", Short: "Docker Buildx", @@ -68,6 +86,12 @@ func setup() { "aliases": "docker image build, docker buildx build, docker buildx b, docker build", }, } + buildxDialStdioCmd = &cobra.Command{ + Use: "dial-stdio", + Short: "Proxy current stdio streams to builder instance", + Args: cobra.NoArgs, + Run: func(cmd *cobra.Command, args []string) {}, + } buildxInstallCmd = &cobra.Command{ Use: "install", Short: "Install buildx as a 'docker builder' alias", @@ -187,7 +211,13 @@ format: "default|[=|[,]]"`) buildxBuildFlags.BoolVar(&ignoreBool, "force-rm", false, "Always remove intermediate containers") buildxBuildFlags.MarkHidden("force-rm") + buildxDialStdioFlags := buildxDialStdioCmd.Flags() + + buildxDialStdioFlags.String("platform", os.Getenv("DOCKER_DEFAULT_PLATFORM"), "Target platform: this is used for node selection") + buildxDialStdioFlags.String("progress", "quiet", "Set type of progress output (auto, plain, tty).") + buildxCmd.AddCommand(buildxBuildCmd) + buildxCmd.AddCommand(buildxDialStdioCmd) buildxCmd.AddCommand(buildxInstallCmd) buildxCmd.AddCommand(buildxStopCmd) dockerCmd.AddCommand(buildxCmd) @@ -205,7 +235,7 @@ func TestGenAllTree(t *testing.T) { require.NoError(t, copyFile(path.Join("fixtures", "buildx_stop.pre.md"), path.Join(tmpdir, "buildx_stop.md"))) c, err := New(Options{ - Root: buildxCmd, + Root: dockerCmd, SourceDir: tmpdir, Plugin: true, ManHeader: &doc.GenManHeader{ diff --git a/clidocstool_yaml_test.go b/clidocstool_yaml_test.go index 308d85f..5554312 100644 --- a/clidocstool_yaml_test.go +++ b/clidocstool_yaml_test.go @@ -31,12 +31,12 @@ func TestGenYamlTree(t *testing.T) { tmpdir := t.TempDir() c, err := New(Options{ - Root: buildxCmd, + Root: dockerCmd, SourceDir: tmpdir, Plugin: true, }) require.NoError(t, err) - require.NoError(t, c.GenYamlTree(buildxCmd)) + require.NoError(t, c.GenYamlTree(dockerCmd)) seen := make(map[string]struct{}) diff --git a/fixtures/attach.md b/fixtures/attach.md new file mode 100644 index 0000000..09ceeea --- /dev/null +++ b/fixtures/attach.md @@ -0,0 +1,20 @@ +# docker attach + + +Attach local standard input, output, and error streams to a running container + +### Aliases + +`docker container attach`, `docker attach` + +### Options + +| Name | Type | Default | Description | +|:----------------|:---------|:--------|:----------------------------------------------------| +| `--detach-keys` | `string` | | Override the key sequence for detaching a container | +| `--no-stdin` | `bool` | | Do not attach STDIN | +| `--sig-proxy` | `bool` | `true` | Proxy all received signals to the process | + + + + diff --git a/fixtures/buildx.md b/fixtures/buildx.md index 607fec9..548a7e8 100644 --- a/fixtures/buildx.md +++ b/fixtures/buildx.md @@ -5,10 +5,11 @@ Extended build capabilities with BuildKit ### Subcommands -| Name | Description | -|:---------------------------|:----------------------| -| [`build`](buildx_build.md) | Start a build | -| [`stop`](buildx_stop.md) | Stop builder instance | +| Name | Description | +|:-------------------------------------|:------------------------------------------------| +| [`build`](buildx_build.md) | Start a build | +| [`dial-stdio`](buildx_dial-stdio.md) | Proxy current stdio streams to builder instance | +| [`stop`](buildx_stop.md) | Stop builder instance | ### Options diff --git a/fixtures/buildx_dial-stdio.md b/fixtures/buildx_dial-stdio.md new file mode 100644 index 0000000..2930248 --- /dev/null +++ b/fixtures/buildx_dial-stdio.md @@ -0,0 +1,16 @@ +# docker buildx dial-stdio + + +Proxy current stdio streams to builder instance + +### Options + +| Name | Type | Default | Description | +|:-------------|:---------|:--------|:-------------------------------------------------| +| `--builder` | `string` | | Override the configured builder instance | +| `--platform` | `string` | | Target platform: this is used for node selection | +| `--progress` | `string` | `quiet` | Set type of progress output (auto, plain, tty). | + + + + diff --git a/fixtures/docker-attach.1 b/fixtures/docker-attach.1 new file mode 100644 index 0000000..2cac572 --- /dev/null +++ b/fixtures/docker-attach.1 @@ -0,0 +1,39 @@ +.nh +.TH "DOCKER" "1" "Jan 2020" "Docker Community" "Docker User Manuals" + +.SH NAME +.PP +docker-attach - Attach local standard input, output, and error streams to a running container + + +.SH SYNOPSIS +.PP +\fBdocker attach [OPTIONS] CONTAINER\fP + + +.SH DESCRIPTION +.PP +Attach local standard input, output, and error streams to a running container + + +.SH OPTIONS +.PP +\fB--detach-keys\fP="" + Override the key sequence for detaching a container + +.PP +\fB-h\fP, \fB--help\fP[=false] + help for attach + +.PP +\fB--no-stdin\fP[=false] + Do not attach STDIN + +.PP +\fB--sig-proxy\fP[=true] + Proxy all received signals to the process + + +.SH SEE ALSO +.PP +\fBdocker(1)\fP diff --git a/fixtures/docker-buildx-dial-stdio.1 b/fixtures/docker-buildx-dial-stdio.1 new file mode 100644 index 0000000..5c28476 --- /dev/null +++ b/fixtures/docker-buildx-dial-stdio.1 @@ -0,0 +1,41 @@ +.nh +.TH "DOCKER" "1" "Jan 2020" "Docker Community" "Docker User Manuals" + +.SH NAME +.PP +docker-buildx-dial-stdio - Proxy current stdio streams to builder instance + + +.SH SYNOPSIS +.PP +\fBdocker buildx dial-stdio\fP + + +.SH DESCRIPTION +.PP +Proxy current stdio streams to builder instance + + +.SH OPTIONS +.PP +\fB-h\fP, \fB--help\fP[=false] + help for dial-stdio + +.PP +\fB--platform\fP="" + Target platform: this is used for node selection + +.PP +\fB--progress\fP="quiet" + Set type of progress output (auto, plain, tty). + + +.SH OPTIONS INHERITED FROM PARENT COMMANDS +.PP +\fB--builder\fP="" + Override the configured builder instance + + +.SH SEE ALSO +.PP +\fBdocker-buildx(1)\fP diff --git a/fixtures/docker-buildx.1 b/fixtures/docker-buildx.1 index 51910d3..f7f4742 100644 --- a/fixtures/docker-buildx.1 +++ b/fixtures/docker-buildx.1 @@ -28,4 +28,4 @@ Extended build capabilities with BuildKit .SH SEE ALSO .PP -\fBdocker(1)\fP, \fBdocker-buildx-build(1)\fP, \fBdocker-buildx-stop(1)\fP +\fBdocker(1)\fP, \fBdocker-buildx-build(1)\fP, \fBdocker-buildx-dial-stdio(1)\fP, \fBdocker-buildx-stop(1)\fP diff --git a/fixtures/docker_attach.yaml b/fixtures/docker_attach.yaml new file mode 100644 index 0000000..e950296 --- /dev/null +++ b/fixtures/docker_attach.yaml @@ -0,0 +1,46 @@ +command: docker attach +aliases: docker container attach, docker attach +short: | + Attach local standard input, output, and error streams to a running container +long: | + Attach local standard input, output, and error streams to a running container +usage: docker attach [OPTIONS] CONTAINER +pname: docker +plink: docker.yaml +options: + - option: detach-keys + value_type: string + description: Override the key sequence for detaching a container + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: no-stdin + value_type: bool + default_value: "false" + description: Do not attach STDIN + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: sig-proxy + value_type: bool + default_value: "true" + description: Proxy all received signals to the process + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false +deprecated: false +hidden: false +experimental: false +experimentalcli: false +kubernetes: false +swarm: false + diff --git a/fixtures/docker_buildx.yaml b/fixtures/docker_buildx.yaml index c8b5cb5..93be880 100644 --- a/fixtures/docker_buildx.yaml +++ b/fixtures/docker_buildx.yaml @@ -5,9 +5,11 @@ pname: docker plink: docker.yaml cname: - docker buildx build + - docker buildx dial-stdio - docker buildx stop clink: - docker_buildx_build.yaml + - docker_buildx_dial-stdio.yaml - docker_buildx_stop.yaml options: - option: builder diff --git a/fixtures/docker_buildx_dial-stdio.yaml b/fixtures/docker_buildx_dial-stdio.yaml new file mode 100644 index 0000000..d9bc7e3 --- /dev/null +++ b/fixtures/docker_buildx_dial-stdio.yaml @@ -0,0 +1,43 @@ +command: docker buildx dial-stdio +short: Proxy current stdio streams to builder instance +long: Proxy current stdio streams to builder instance +usage: docker buildx dial-stdio +pname: docker buildx +plink: docker_buildx.yaml +options: + - option: platform + value_type: string + description: 'Target platform: this is used for node selection' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: progress + value_type: string + default_value: quiet + description: Set type of progress output (auto, plain, tty). + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false +inherited_options: + - option: builder + value_type: string + description: Override the configured builder instance + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false +deprecated: false +hidden: false +experimental: false +experimentalcli: false +kubernetes: false +swarm: false +