From 832678ba735a0f9b203637d667d27b3ec064e044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20=C3=85hall?= Date: Sat, 22 Jul 2023 09:57:02 +0200 Subject: [PATCH] Added command line arg -version --- main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main.go b/main.go index b878d24..fe24293 100644 --- a/main.go +++ b/main.go @@ -26,6 +26,7 @@ const DB_SCHEMA = 13 var ( flagPort int + flagVersion bool connectionManager ConnectionManager static http.Handler config Config @@ -38,6 +39,7 @@ func init() {// {{{ 1371, "TCP port to listen on", ) + flag.BoolVar(&flagVersion, "version", false, "Shows Notes version and exists") flag.Parse() @@ -47,6 +49,12 @@ func init() {// {{{ }// }}} func main() {// {{{ var err error + + if flagVersion { + fmt.Printf("%s\n", VERSION) + os.Exit(0) + } + log.Printf("\x1b[32mNotes\x1b[0m %s\n", VERSION) config, err = ConfigRead(os.Getenv("HOME")+"/.config/notes.yaml")