2019-04-25 07:16:30 +08:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2021-11-05 01:52:11 +08:00
|
|
|
"github.com/docker/buildx/util/cobrautil"
|
2019-04-25 10:29:56 +08:00
|
|
|
"github.com/docker/buildx/version"
|
2019-04-25 07:16:30 +08:00
|
|
|
"github.com/docker/cli/cli"
|
|
|
|
"github.com/docker/cli/cli/command"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
func runVersion(dockerCli command.Cli) error {
|
|
|
|
fmt.Println(version.Package, version.Version, version.Revision)
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func versionCmd(dockerCli command.Cli) *cobra.Command {
|
|
|
|
cmd := &cobra.Command{
|
|
|
|
Use: "version",
|
2021-03-24 23:54:49 +08:00
|
|
|
Short: "Show buildx version information",
|
2019-04-25 07:16:30 +08:00
|
|
|
Args: cli.ExactArgs(0),
|
|
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
|
|
return runVersion(dockerCli)
|
|
|
|
},
|
|
|
|
}
|
2021-11-05 01:52:11 +08:00
|
|
|
|
|
|
|
// hide builder persistent flag for this command
|
|
|
|
cobrautil.HideInheritedFlags(cmd, "builder")
|
|
|
|
|
2019-04-25 07:16:30 +08:00
|
|
|
return cmd
|
|
|
|
}
|