aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/main.go b/main.go
index 9040a70..c0deb6c 100644
--- a/main.go
+++ b/main.go
@@ -25,6 +25,8 @@ import (
"gopkg.in/yaml.v3"
)
+var Version = "Development"
+
var logger = log.New(os.Stderr, "", 0)
var ID_BYTES = 8
@@ -230,8 +232,14 @@ func main() {
debug := fl.Bool("d", false, "debugging add information to the logging output DEBUG=true|false controls this as well")
storage := fl.String("s", "", "Directory to serve, must be supplied via flag or STORAGE_DIR environment variable")
fl.IntVar(&ID_BYTES, "b", ID_BYTES, "How many random bytes for the id?")
+ version := fl.Bool("v", false, "Print version and exit")
+
_ = fl.Parse(os.Args[1:])
+ if *version {
+ logger.Fatal(Version)
+ }
+
if addr := os.Getenv("LISTEN_ADDR"); addr != "" {
*listen = addr
}