Browse Source

Version flag

master
parent
commit
4004d144cf
  1. 9
      src/main.go

9
src/main.go

@ -18,6 +18,7 @@ package main
import ( import (
"flag" "flag"
"fmt"
"io" "io"
"os" "os"
"path/filepath" "path/filepath"
@ -26,12 +27,13 @@ import (
"unbewohnte/gochat/server" "unbewohnte/gochat/server"
) )
const version string = "0.1.2" const versionNumber string = "0.1.2"
var ( var (
port *uint = flag.Uint("port", 8080, "Set working port") port *uint = flag.Uint("port", 8080, "Set working port")
tlsKeyFile *string = flag.String("tlsKeyFile", "", "Specify tls key file") tlsKeyFile *string = flag.String("tlsKeyFile", "", "Specify tls key file")
tlsCertFile *string = flag.String("tlsCertFile", "", "Specify tls cert file") tlsCertFile *string = flag.String("tlsCertFile", "", "Specify tls cert file")
version *bool = flag.Bool("version", false, "Print version information")
) )
func main() { func main() {
@ -63,6 +65,11 @@ func main() {
// parse flags // parse flags
flag.Parse() flag.Parse()
if *version {
fmt.Printf("gochat v%s\n\n(C) 2022 Unbewohnte (Kasyanov Nikolay Alexeyevich)\n", versionNumber)
return
}
const dbFilename string = "gochat.db" const dbFilename string = "gochat.db"
dbPath := filepath.Join(exeDirPath, dbFilename) dbPath := filepath.Join(exeDirPath, dbFilename)

Loading…
Cancel
Save