'version' command in zrok executable (#56)

This commit is contained in:
Michael Quigley 2022-11-02 17:31:28 -04:00
parent 204e59dad0
commit 33199b0e93
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62

29
cmd/zrok/version.go Normal file
View File

@ -0,0 +1,29 @@
package main
import (
"fmt"
"github.com/openziti-test-kitchen/zrok/build"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(newVersionCommand().cmd)
}
type versionCommand struct {
cmd *cobra.Command
}
func newVersionCommand() *versionCommand {
cmd := &cobra.Command{
Use: "version",
Args: cobra.ExactArgs(0),
}
command := &versionCommand{cmd: cmd}
cmd.Run = command.run
return command
}
func (cmd *versionCommand) run(_ *cobra.Command, _ []string) {
fmt.Println(" _ \n _____ __ ___ | | __\n|_ / '__/ _ \\| |/ /\n / /| | | (_) | < \n/___|_| \\___/|_|\\_\\\n\n" + build.String() + "\n")
}