Explorar o código

Renamed ExecIfDefaultCtxType for more explicit behaviour

Guillaume Tardif %!s(int64=5) %!d(string=hai) anos
pai
achega
ab3cd0fec1
Modificáronse 2 ficheiros con 5 adicións e 5 borrados
  1. 3 3
      cli/main.go
  2. 2 2
      cli/mobycli/exec.go

+ 3 - 3
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)

+ 2 - 2
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)