Add version output support when built
This commit is contained in:
parent
659fca62a8
commit
8f1aa0651c
1 changed files with 10 additions and 0 deletions
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/tblyler/hoarder/queue"
|
||||
"gopkg.in/yaml.v2"
|
||||
"io/ioutil"
|
||||
|
@ -10,10 +11,19 @@ import (
|
|||
"os/signal"
|
||||
)
|
||||
|
||||
var buildVersion = "Unknown"
|
||||
var buildDate = "Unknown"
|
||||
|
||||
func main() {
|
||||
version := flag.Bool("version", false, "display version info")
|
||||
configPath := flag.String("config", "", "path to the config file")
|
||||
flag.Parse()
|
||||
|
||||
if *version {
|
||||
fmt.Printf("%s\n%s\n", buildVersion, buildDate)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
logger := log.New(os.Stdout, "hoarder ", log.LstdFlags)
|
||||
|
||||
if *configPath == "" {
|
||||
|
|
Loading…
Reference in a new issue