mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2025-01-11 09:20:17 +01:00
Unified handling of printing versions of programs (--version). Setting version to 0.5
This commit is contained in:
parent
f6b5f9ce97
commit
62a53dc26b
@ -98,6 +98,7 @@ func main() {
|
|||||||
dstBackend string
|
dstBackend string
|
||||||
srcInterleaved bool
|
srcInterleaved bool
|
||||||
dstInterleaved bool
|
dstInterleaved bool
|
||||||
|
version bool
|
||||||
)
|
)
|
||||||
|
|
||||||
flag.Usage = usage
|
flag.Usage = usage
|
||||||
@ -118,9 +119,14 @@ func main() {
|
|||||||
"Should dest database be interleaved?")
|
"Should dest database be interleaved?")
|
||||||
flag.BoolVar(&dstInterleaved, "di", true,
|
flag.BoolVar(&dstInterleaved, "di", true,
|
||||||
"Should source database be interleaved? Shorthand")
|
"Should source database be interleaved? Shorthand")
|
||||||
|
flag.BoolVar(&version, "version", false, "Print version and exit.")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
if version {
|
||||||
|
common.PrintVersionAndExit()
|
||||||
|
}
|
||||||
|
|
||||||
if flag.NArg() < 2 {
|
if flag.NArg() < 2 {
|
||||||
log.Fatal("Missing source and/or destination database.")
|
log.Fatal("Missing source and/or destination database.")
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,12 @@ import (
|
|||||||
"os/signal"
|
"os/signal"
|
||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"bitbucket.org/s_l_teichmann/mtsatellite/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
defaultMaxBulkStringSize = 32 * 1024 * 1024
|
defaultMaxBulkStringSize = 32 * 1024 * 1024
|
||||||
Version = "0.3"
|
|
||||||
GCDuration = "24h"
|
GCDuration = "24h"
|
||||||
ChangeDuration = "30s"
|
ChangeDuration = "30s"
|
||||||
)
|
)
|
||||||
@ -63,8 +64,7 @@ func main() {
|
|||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if version {
|
if version {
|
||||||
fmt.Printf("Version: %s\n", Version)
|
common.PrintVersionAndExit()
|
||||||
os.Exit(0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if flag.NArg() < 1 {
|
if flag.NArg() < 1 {
|
||||||
|
@ -25,6 +25,7 @@ func main() {
|
|||||||
skipPyramid bool
|
skipPyramid bool
|
||||||
transparent bool
|
transparent bool
|
||||||
transparentDim float64
|
transparentDim float64
|
||||||
|
version bool
|
||||||
)
|
)
|
||||||
|
|
||||||
flag.IntVar(&port, "port", 6379, "port to of mtredisalize server")
|
flag.IntVar(&port, "port", 6379, "port to of mtredisalize server")
|
||||||
@ -51,9 +52,14 @@ func main() {
|
|||||||
flag.Float64Var(&transparentDim,
|
flag.Float64Var(&transparentDim,
|
||||||
"td", common.DefaultTransparentDim*100.0,
|
"td", common.DefaultTransparentDim*100.0,
|
||||||
"Extra fimming of transparent nodes each depth meter in percent. (shorthand)")
|
"Extra fimming of transparent nodes each depth meter in percent. (shorthand)")
|
||||||
|
flag.BoolVar(&version, "version", false, "Print version and exit.")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
if version {
|
||||||
|
common.PrintVersionAndExit()
|
||||||
|
}
|
||||||
|
|
||||||
if !skipBaseLevel {
|
if !skipBaseLevel {
|
||||||
td := common.Clamp32f(float32(transparentDim/100.0), 0.0, 1.0)
|
td := common.Clamp32f(float32(transparentDim/100.0), 0.0, 1.0)
|
||||||
address := fmt.Sprintf("%s:%d", host, port)
|
address := fmt.Sprintf("%s:%d", host, port)
|
||||||
|
@ -28,6 +28,7 @@ func main() {
|
|||||||
transparent bool
|
transparent bool
|
||||||
cpuProfile string
|
cpuProfile string
|
||||||
transparentDim float64
|
transparentDim float64
|
||||||
|
version bool
|
||||||
)
|
)
|
||||||
|
|
||||||
flag.IntVar(&port, "port", 6379, "port to of mtredisalize server")
|
flag.IntVar(&port, "port", 6379, "port to of mtredisalize server")
|
||||||
@ -51,9 +52,14 @@ func main() {
|
|||||||
&transparentDim, "transparent-dim", common.DefaultTransparentDim*100,
|
&transparentDim, "transparent-dim", common.DefaultTransparentDim*100,
|
||||||
"Extra dimming of transparent nodes every depth meter in percent (0-100).")
|
"Extra dimming of transparent nodes every depth meter in percent (0-100).")
|
||||||
flag.StringVar(&cpuProfile, "cpuprofile", "", "write cpu profile to file")
|
flag.StringVar(&cpuProfile, "cpuprofile", "", "write cpu profile to file")
|
||||||
|
flag.BoolVar(&version, "version", false, "Print version and exit.")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
if version {
|
||||||
|
common.PrintVersionAndExit()
|
||||||
|
}
|
||||||
|
|
||||||
if cpuProfile != "" {
|
if cpuProfile != "" {
|
||||||
f, err := os.Create(cpuProfile)
|
f, err := os.Create(cpuProfile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -31,6 +31,7 @@ func main() {
|
|||||||
updateHosts string
|
updateHosts string
|
||||||
websockets bool
|
websockets bool
|
||||||
playersFIFO string
|
playersFIFO string
|
||||||
|
version bool
|
||||||
)
|
)
|
||||||
flag.IntVar(&webPort, "web-port", 8808, "port of the web server")
|
flag.IntVar(&webPort, "web-port", 8808, "port of the web server")
|
||||||
flag.IntVar(&webPort, "p", 8808, "port of the web server (shorthand)")
|
flag.IntVar(&webPort, "p", 8808, "port of the web server (shorthand)")
|
||||||
@ -63,9 +64,14 @@ func main() {
|
|||||||
flag.BoolVar(&websockets, "ws", false, "Forward tile changes to clients via websockets (shorthand).")
|
flag.BoolVar(&websockets, "ws", false, "Forward tile changes to clients via websockets (shorthand).")
|
||||||
flag.StringVar(&playersFIFO, "players", "", "Path to FIFO file to read active players from.")
|
flag.StringVar(&playersFIFO, "players", "", "Path to FIFO file to read active players from.")
|
||||||
flag.StringVar(&playersFIFO, "ps", "", "Path to FIFO file to read active players from (shorthand).")
|
flag.StringVar(&playersFIFO, "ps", "", "Path to FIFO file to read active players from (shorthand).")
|
||||||
|
flag.BoolVar(&version, "version", false, "Print version and exit.")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
if version {
|
||||||
|
common.PrintVersionAndExit()
|
||||||
|
}
|
||||||
|
|
||||||
router := mux.NewRouter()
|
router := mux.NewRouter()
|
||||||
|
|
||||||
subBaseLine := newSubBaseLine(mapDir)
|
subBaseLine := newSubBaseLine(mapDir)
|
||||||
|
17
common/version.go
Normal file
17
common/version.go
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2014 by Sascha L. Teichmann
|
||||||
|
// Use of this source code is governed by the MIT license
|
||||||
|
// that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
const MTSatelliteVersion = "0.5"
|
||||||
|
|
||||||
|
func PrintVersionAndExit() {
|
||||||
|
fmt.Printf("Version: %s\n", MTSatelliteVersion)
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user