avm99963 | 88e622d | 2021-01-22 18:57:58 +0100 | [diff] [blame] | 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "github.com/spf13/cobra" |
| 5 | |
| 6 | "github.com/flashmob/go-guerrilla" |
| 7 | ) |
| 8 | |
| 9 | var versionCmd = &cobra.Command{ |
| 10 | Use: "version", |
| 11 | Short: "Print the version info", |
| 12 | Long: `Every software has a version. This is Guerrilla's`, |
| 13 | Run: func(cmd *cobra.Command, args []string) { |
| 14 | logVersion() |
| 15 | }, |
| 16 | } |
| 17 | |
| 18 | func init() { |
| 19 | rootCmd.AddCommand(versionCmd) |
| 20 | } |
| 21 | |
| 22 | func logVersion() { |
| 23 | mainlog.Infof("Using guerrilla %s", guerrilla.Version) |
| 24 | mainlog.Debugf("Build Time: %s", guerrilla.BuildTime) |
| 25 | mainlog.Debugf("Commit: %s", guerrilla.Commit) |
| 26 | } |