cli-plugins: only parse global arguments once.

This fixes `TestGlobalArgsOnlyParsedOnce/plugin` in the cli-plugins e2e tests.

Signed-off-by: Ian Campbell <ijc@docker.com>
This commit is contained in:
Ian Campbell 2019-04-03 12:00:38 +01:00
parent 8c087b6a1e
commit 1425aeba4a
1 changed files with 4 additions and 1 deletions

View File

@ -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()
}