replace version command with flag

master
Norwin 5 years ago
parent e3df49f8bf
commit 83fb1e7d76

@ -104,6 +104,7 @@ var rootCmd = &cobra.Command{
Use: "osem_notify",
Short: "Root command displaying help",
Long: "Run healthchecks and send notifications for boxes on opensensemap.org",
Version: "1.3.0",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
// set up logger
log.SetOutput(os.Stdout)

@ -1,26 +0,0 @@
package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
// TODO: insert automatically via build step?
const (
VERSION = "1.3.0"
BUILDDATE = "2019-02-10T16:00:00+00"
)
func init() {
rootCmd.AddCommand(versionCmd)
}
var versionCmd = &cobra.Command{
Use: "version",
Short: "Get build and version information",
Long: "osem_notify version returns its build and version information",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("%s %s", VERSION, BUILDDATE)
},
}
Loading…
Cancel
Save