load plugin command stubs when required
We are currently loading plugin command stubs for every invocation which still has a significant performance hit. With this change we are doing this operation only if cobra completion arg request is found. - 20.10.23: `docker --version` takes ~15ms - 23.0.1: `docker --version` takes ~93ms With this change `docker --version` takes ~9ms Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
@ -83,7 +83,7 @@ func TestHelpBad(t *testing.T) {
|
||||
|
||||
res := icmd.RunCmd(run("help", "badmeta"))
|
||||
res.Assert(t, icmd.Expected{
|
||||
ExitCode: 0,
|
||||
ExitCode: 1,
|
||||
Out: icmd.None,
|
||||
})
|
||||
golden.Assert(t, res.Stderr(), "docker-help-badmeta-err.golden")
|
||||
@ -110,8 +110,8 @@ func TestBadHelp(t *testing.T) {
|
||||
res.Assert(t, icmd.Expected{
|
||||
ExitCode: 0,
|
||||
// This should be identical to the --help case above
|
||||
Out: usage,
|
||||
Err: shortHFlagDeprecated,
|
||||
Out: shortHFlagDeprecated + usage,
|
||||
Err: icmd.None,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user