Merge pull request #3971 from thaJeztah/sync_cobra_streams

cli: pass dockerCLI's in/out/err to cobra cmds
This commit is contained in:
Sebastiaan van Stijn 2023-01-17 17:57:03 +01:00 committed by GitHub
commit 8627a6df16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -133,7 +133,9 @@ func newPluginCommand(dockerCli *command.DockerCli, plugin *cobra.Command, meta
} }
opts, flags := cli.SetupPluginRootCommand(cmd) opts, flags := cli.SetupPluginRootCommand(cmd)
cmd.SetIn(dockerCli.In())
cmd.SetOut(dockerCli.Out()) cmd.SetOut(dockerCli.Out())
cmd.SetErr(dockerCli.Err())
cmd.AddCommand( cmd.AddCommand(
plugin, plugin,

View File

@ -51,6 +51,10 @@ func newDockerCommand(dockerCli *command.DockerCli) *cli.TopLevelCommand {
DisableDescriptions: true, DisableDescriptions: true,
}, },
} }
cmd.SetIn(dockerCli.In())
cmd.SetOut(dockerCli.Out())
cmd.SetErr(dockerCli.Err())
opts, flags, helpCmd = cli.SetupRootCommand(cmd) opts, flags, helpCmd = cli.SetupRootCommand(cmd)
registerCompletionFuncForGlobalFlags(dockerCli, cmd) registerCompletionFuncForGlobalFlags(dockerCli, cmd)
flags.BoolP("version", "v", false, "Print version information and quit") flags.BoolP("version", "v", false, "Print version information and quit")