better versioning
This commit is contained in:
1 parent
7f58254dbc
commit
092ef6185f
3 files changed
+18
-1
No files matched your search
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
@@ -16,11 +17,20 @@ import (
|
||||
"slackerbot/internal/state"
|
||||
)
|
||||
|
||||
var version = "dev"
|
||||
|
||||
func main() {
|
||||
cfgPath := flag.String("config", "/etc/slackerbot/config.toml", "path to the config file")
|
||||
mode := flag.String("mode", config.ModeMaster, "master (runs the Slack bot) or slave (runs containers for a master)")
|
||||
showVersion := flag.Bool("version", false, "print the version and exit")
|
||||
flag.Parse()
|
||||
|
||||
if *showVersion {
|
||||
fmt.Println(version)
|
||||
return
|
||||
}
|
||||
log.Printf("slackerbot %s", version)
|
||||
|
||||
cfg, err := config.LoadConfig(*cfgPath, *mode)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
||||
Reference in new issue
Block a user