From 1425aeba4a447001c899762fcadff65753d73ede Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 3 Apr 2019 12:00:38 +0100 Subject: [PATCH] cli-plugins: only parse global arguments once. This fixes `TestGlobalArgsOnlyParsedOnce/plugin` in the cli-plugins e2e tests. Signed-off-by: Ian Campbell --- cli-plugins/plugin/plugin.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cli-plugins/plugin/plugin.go b/cli-plugins/plugin/plugin.go index dfcd466ebd..62ab11c9e6 100644 --- a/cli-plugins/plugin/plugin.go +++ b/cli-plugins/plugin/plugin.go @@ -40,10 +40,13 @@ func runPlugin(dockerCli *command.DockerCli, plugin *cobra.Command, meta manager return err } - cmd, _, err := tcmd.HandleGlobalFlags() + cmd, args, err := tcmd.HandleGlobalFlags() if err != nil { return err } + // We've parsed global args already, so reset args to those + // which remain. + cmd.SetArgs(args) return cmd.Execute() }