gotygen/cmd/version.go

24 lines
352 B
Go
Raw Normal View History

2023-02-13 12:49:37 +00:00
package cmd
import (
"os"
2023-02-14 14:23:46 +00:00
"github.com/spf13/cobra"
2023-02-13 12:49:37 +00:00
)
2023-02-15 12:52:57 +00:00
const version = "0.0.2"
2023-02-13 12:49:37 +00:00
var versionCmd = &cobra.Command{
Use: "version",
2023-02-14 14:23:46 +00:00
Short: "Print the version number of gotygen",
2023-02-13 12:49:37 +00:00
Run: func(cmd *cobra.Command, args []string) {
2023-02-14 14:23:46 +00:00
cmd.Println("gotygen v", version)
2023-02-13 12:49:37 +00:00
},
}
func init() {
versionCmd.SetOut(os.Stdout)
rootCmd.AddCommand(versionCmd)
}