|
|
@ -4,6 +4,9 @@ import (
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/docker/buildx/bake"
|
|
|
|
"github.com/docker/buildx/bake"
|
|
|
|
|
|
|
|
"github.com/docker/buildx/builder"
|
|
|
|
|
|
|
|
"github.com/docker/buildx/store/storeutil"
|
|
|
|
|
|
|
|
"github.com/docker/cli/cli/command"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -36,3 +39,24 @@ func BakeTargets(files []string) ValidArgsFn {
|
|
|
|
return filtered, cobra.ShellCompDirectiveNoFileComp
|
|
|
|
return filtered, cobra.ShellCompDirectiveNoFileComp
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func BuilderNames(dockerCli command.Cli) ValidArgsFn {
|
|
|
|
|
|
|
|
return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
|
|
|
|
|
|
|
txn, release, err := storeutil.GetStore(dockerCli)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return nil, cobra.ShellCompDirectiveError
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
defer release()
|
|
|
|
|
|
|
|
builders, err := builder.GetBuilders(dockerCli, txn)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return nil, cobra.ShellCompDirectiveError
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var filtered []string
|
|
|
|
|
|
|
|
for _, b := range builders {
|
|
|
|
|
|
|
|
if toComplete == "" || strings.HasPrefix(b.Name, toComplete) {
|
|
|
|
|
|
|
|
filtered = append(filtered, b.Name)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return filtered, cobra.ShellCompDirectiveNoFileComp
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|