bake: read original command name from the env for prompt

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi 2024-09-03 08:54:42 -07:00
parent 203fd8aee5
commit 5ecff53e0c
No known key found for this signature in database
GPG Key ID: AFA9DE5F8AB7AF39
1 changed files with 2 additions and 3 deletions

View File

@ -6,7 +6,6 @@ import (
"fmt" "fmt"
"io" "io"
"os" "os"
"path/filepath"
"slices" "slices"
"strings" "strings"
@ -143,8 +142,8 @@ func (c EntitlementConf) Prompt(ctx context.Context, out io.Writer) error {
} }
args := append([]string(nil), os.Args...) args := append([]string(nil), os.Args...)
if filepath.Base(args[0]) == "docker-buildx" { if v, ok := os.LookupEnv("DOCKER_CLI_PLUGIN_ORIGINAL_CLI_COMMAND"); ok && v != "" {
args[0] = "docker" args[0] = v
} }
idx := slices.Index(args, "bake") idx := slices.Index(args, "bake")