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 (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
|
"fmt"
|
||||||
"github.com/tblyler/hoarder/queue"
|
"github.com/tblyler/hoarder/queue"
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
@ -10,10 +11,19 @@ import (
|
||||||
"os/signal"
|
"os/signal"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var buildVersion = "Unknown"
|
||||||
|
var buildDate = "Unknown"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
version := flag.Bool("version", false, "display version info")
|
||||||
configPath := flag.String("config", "", "path to the config file")
|
configPath := flag.String("config", "", "path to the config file")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
if *version {
|
||||||
|
fmt.Printf("%s\n%s\n", buildVersion, buildDate)
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
logger := log.New(os.Stdout, "hoarder ", log.LstdFlags)
|
logger := log.New(os.Stdout, "hoarder ", log.LstdFlags)
|
||||||
|
|
||||||
if *configPath == "" {
|
if *configPath == "" {
|
||||||
|
|
Loading…
Reference in a new issue