2018-02-01 16:14:16 +01:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
2018-04-20 08:58:02 +02:00
|
|
|
// VERSION is set at build time
|
2018-02-01 16:14:16 +01:00
|
|
|
var VERSION string
|
|
|
|
|
|
|
|
// versionCMD to print version
|
|
|
|
var versionCMD = &cobra.Command{
|
|
|
|
Use: "version",
|
|
|
|
Short: "print version of yanic",
|
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
|
|
|
|
fmt.Printf("yanic version: %s\n", VERSION)
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
if VERSION != "" {
|
|
|
|
RootCmd.AddCommand(versionCMD)
|
|
|
|
}
|
|
|
|
}
|