Skip to content

Commit

Permalink
cli-plugins: only parse global arguments once.
Browse files Browse the repository at this point in the history
This fixes `TestGlobalArgsOnlyParsedOnce/plugin` in the cli-plugins e2e tests.

Signed-off-by: Ian Campbell <ijc@docker.com>
  • Loading branch information
Ian Campbell committed Apr 3, 2019
1 parent 984fbba commit c2453a6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cli-plugins/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down

0 comments on commit c2453a6

Please sign in to comment.