mirror of https://github.com/docker/cli.git
Merge pull request #3795 from thaJeztah/ignore_stubs_in_aliases
fix broken alias check is buildx is installed as alias for builder
This commit is contained in:
commit
a496a7d501
|
@ -4,6 +4,7 @@ import (
|
|||
"os"
|
||||
"strings"
|
||||
|
||||
pluginmanager "github.com/docker/cli/cli-plugins/manager"
|
||||
"github.com/docker/cli/cli/command"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -26,8 +27,10 @@ func processAliases(dockerCli command.Cli, cmd *cobra.Command, args, osArgs []st
|
|||
if _, ok := allowedAliases[k]; !ok {
|
||||
return args, osArgs, errors.Errorf("not allowed to alias %q (allowed: %#v)", k, allowedAliases)
|
||||
}
|
||||
if _, _, err := cmd.Find(strings.Split(v, " ")); err == nil {
|
||||
return args, osArgs, errors.Errorf("not allowed to alias with builtin %q as target", v)
|
||||
if c, _, err := cmd.Find(strings.Split(v, " ")); err == nil {
|
||||
if c.Annotations[pluginmanager.CommandAnnotationPlugin] != "true" {
|
||||
return args, osArgs, errors.Errorf("not allowed to alias with builtin %q as target", v)
|
||||
}
|
||||
}
|
||||
aliases = append(aliases, [2][]string{{k}, {v}})
|
||||
}
|
||||
|
|
|
@ -218,12 +218,12 @@ func runDocker(dockerCli *command.DockerCli) error {
|
|||
return err
|
||||
}
|
||||
|
||||
err = pluginmanager.AddPluginCommandStubs(dockerCli, cmd)
|
||||
args, os.Args, err = processAliases(dockerCli, cmd, args, os.Args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
args, os.Args, err = processAliases(dockerCli, cmd, args, os.Args)
|
||||
err = pluginmanager.AddPluginCommandStubs(dockerCli, cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue