diff --git a/cli/main.go b/cli/main.go index d44a8aeb..a8dd0be2 100644 --- a/cli/main.go +++ b/cli/main.go @@ -101,7 +101,7 @@ func main() { SilenceUsage: true, PersistentPreRunE: func(cmd *cobra.Command, args []string) error { if !isOwnCommand(cmd) { - mobycli.Exec(cmd.Context()) + mobycli.ExecIfDefaultCtxType(cmd.Context()) } return nil }, @@ -127,7 +127,7 @@ func main() { helpFunc := root.HelpFunc() root.SetHelpFunc(func(cmd *cobra.Command, args []string) { if !isOwnCommand(cmd) { - mobycli.Exec(cmd.Context()) + mobycli.ExecIfDefaultCtxType(cmd.Context()) } helpFunc(cmd, args) }) @@ -168,7 +168,7 @@ func main() { fmt.Fprintln(os.Stderr, err) os.Exit(1) } - mobycli.Exec(ctx) + mobycli.ExecIfDefaultCtxType(ctx) checkIfUnknownCommandExistInDefaultContext(err, currentContext) fmt.Fprintln(os.Stderr, err) diff --git a/cli/mobycli/exec.go b/cli/mobycli/exec.go index 95631edb..9fc0d034 100644 --- a/cli/mobycli/exec.go +++ b/cli/mobycli/exec.go @@ -16,8 +16,8 @@ import ( // ComDockerCli name of the classic cli binary const ComDockerCli = "com.docker.cli" -// Exec delegates to com.docker.cli if on moby context -func Exec(ctx context.Context) { +// ExecIfDefaultCtxType delegates to com.docker.cli if on moby context +func ExecIfDefaultCtxType(ctx context.Context) { currentContext := apicontext.CurrentContext(ctx) s := store.ContextStore(ctx)