commands: add version command

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
pull/47/head
Tonis Tiigi 6 years ago
parent e7e57b626d
commit 6abbf0ee76

@ -34,6 +34,7 @@ func addCommands(cmd *cobra.Command, dockerCli command.Cli) {
stopCmd(dockerCli),
installCmd(dockerCli),
uninstallCmd(dockerCli),
versionCmd(dockerCli),
imagetoolscmd.RootCmd(dockerCli),
)
}

@ -0,0 +1,27 @@
package commands
import (
"fmt"
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/spf13/cobra"
"github.com/tonistiigi/buildx/version"
)
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",
Short: "Show buildx version information ",
Args: cli.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
return runVersion(dockerCli)
},
}
return cmd
}
Loading…
Cancel
Save