Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit e92335e

Browse files
committed
Fix plugin initialization
Signed-off-by: Simon Ferquel <[email protected]>
1 parent 432246c commit e92335e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cmd/docker-app/main.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,18 @@ import (
1111

1212
func main() {
1313
plugin.Run(func(dockerCli command.Cli) *cobra.Command {
14-
return app.NewRootCmd("app", dockerCli)
14+
cmd := app.NewRootCmd("app", dockerCli)
15+
originalPreRun := cmd.PersistentPreRunE
16+
cmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error {
17+
if err := plugin.PersistentPreRunE(cmd, args); err != nil {
18+
return err
19+
}
20+
if originalPreRun != nil {
21+
return originalPreRun(cmd, args)
22+
}
23+
return nil
24+
}
25+
return cmd
1526
}, manager.Metadata{
1627
SchemaVersion: "0.1.0",
1728
Vendor: "Docker Inc.",

0 commit comments

Comments
 (0)