2019-03-24 12:30:29 +08:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
2019-03-26 10:01:31 +08:00
|
|
|
"github.com/docker/cli/cli-plugins/plugin"
|
2019-03-24 12:30:29 +08:00
|
|
|
"github.com/docker/cli/cli/command"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
func NewRootCmd(dockerCli command.Cli) *cobra.Command {
|
|
|
|
cmd := &cobra.Command{
|
|
|
|
Short: "Build with BuildKit",
|
|
|
|
Use: "buildx",
|
2019-03-26 10:01:31 +08:00
|
|
|
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
|
|
|
return plugin.PersistentPreRunE(cmd, args)
|
|
|
|
},
|
2019-03-24 12:30:29 +08:00
|
|
|
}
|
|
|
|
addCommands(cmd, dockerCli)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func addCommands(cmd *cobra.Command, dockerCli command.Cli) {
|
|
|
|
cmd.AddCommand(
|
|
|
|
buildCmd(dockerCli),
|
2019-04-05 15:04:19 +08:00
|
|
|
bakeCmd(dockerCli),
|
2019-03-24 12:30:29 +08:00
|
|
|
)
|
|
|
|
}
|