mirror of
				https://bitbucket.org/s_l_teichmann/mtsatellite
				synced 2025-10-31 08:05:27 +01:00 
			
		
		
		
	Unified handling of printing versions of programs (--version). Setting version to 0.5
This commit is contained in:
		| @@ -98,6 +98,7 @@ func main() { | ||||
| 		dstBackend     string | ||||
| 		srcInterleaved bool | ||||
| 		dstInterleaved bool | ||||
| 		version        bool | ||||
| 	) | ||||
|  | ||||
| 	flag.Usage = usage | ||||
| @@ -118,9 +119,14 @@ func main() { | ||||
| 		"Should dest database be interleaved?") | ||||
| 	flag.BoolVar(&dstInterleaved, "di", true, | ||||
| 		"Should source database be interleaved? Shorthand") | ||||
| 	flag.BoolVar(&version, "version", false, "Print version and exit.") | ||||
|  | ||||
| 	flag.Parse() | ||||
|  | ||||
| 	if version { | ||||
| 		common.PrintVersionAndExit() | ||||
| 	} | ||||
|  | ||||
| 	if flag.NArg() < 2 { | ||||
| 		log.Fatal("Missing source and/or destination database.") | ||||
| 	} | ||||
|   | ||||
| @@ -13,11 +13,12 @@ import ( | ||||
| 	"os/signal" | ||||
| 	"runtime" | ||||
| 	"time" | ||||
|  | ||||
| 	"bitbucket.org/s_l_teichmann/mtsatellite/common" | ||||
| ) | ||||
|  | ||||
| const ( | ||||
| 	defaultMaxBulkStringSize = 32 * 1024 * 1024 | ||||
| 	Version                  = "0.3" | ||||
| 	GCDuration               = "24h" | ||||
| 	ChangeDuration           = "30s" | ||||
| ) | ||||
| @@ -63,8 +64,7 @@ func main() { | ||||
| 	flag.Parse() | ||||
|  | ||||
| 	if version { | ||||
| 		fmt.Printf("Version: %s\n", Version) | ||||
| 		os.Exit(0) | ||||
| 		common.PrintVersionAndExit() | ||||
| 	} | ||||
|  | ||||
| 	if flag.NArg() < 1 { | ||||
|   | ||||
| @@ -25,6 +25,7 @@ func main() { | ||||
| 		skipPyramid    bool | ||||
| 		transparent    bool | ||||
| 		transparentDim float64 | ||||
| 		version        bool | ||||
| 	) | ||||
|  | ||||
| 	flag.IntVar(&port, "port", 6379, "port to of mtredisalize server") | ||||
| @@ -51,9 +52,14 @@ func main() { | ||||
| 	flag.Float64Var(&transparentDim, | ||||
| 		"td", common.DefaultTransparentDim*100.0, | ||||
| 		"Extra fimming of transparent nodes each depth meter in percent. (shorthand)") | ||||
| 	flag.BoolVar(&version, "version", false, "Print version and exit.") | ||||
|  | ||||
| 	flag.Parse() | ||||
|  | ||||
| 	if version { | ||||
| 		common.PrintVersionAndExit() | ||||
| 	} | ||||
|  | ||||
| 	if !skipBaseLevel { | ||||
| 		td := common.Clamp32f(float32(transparentDim/100.0), 0.0, 1.0) | ||||
| 		address := fmt.Sprintf("%s:%d", host, port) | ||||
|   | ||||
| @@ -28,6 +28,7 @@ func main() { | ||||
| 		transparent          bool | ||||
| 		cpuProfile           string | ||||
| 		transparentDim       float64 | ||||
| 		version              bool | ||||
| 	) | ||||
|  | ||||
| 	flag.IntVar(&port, "port", 6379, "port to of mtredisalize server") | ||||
| @@ -51,9 +52,14 @@ func main() { | ||||
| 		&transparentDim, "transparent-dim", common.DefaultTransparentDim*100, | ||||
| 		"Extra dimming of transparent nodes every depth meter in percent (0-100).") | ||||
| 	flag.StringVar(&cpuProfile, "cpuprofile", "", "write cpu profile to file") | ||||
| 	flag.BoolVar(&version, "version", false, "Print version and exit.") | ||||
|  | ||||
| 	flag.Parse() | ||||
|  | ||||
| 	if version { | ||||
| 		common.PrintVersionAndExit() | ||||
| 	} | ||||
|  | ||||
| 	if cpuProfile != "" { | ||||
| 		f, err := os.Create(cpuProfile) | ||||
| 		if err != nil { | ||||
|   | ||||
| @@ -31,6 +31,7 @@ func main() { | ||||
| 		updateHosts    string | ||||
| 		websockets     bool | ||||
| 		playersFIFO    string | ||||
| 		version        bool | ||||
| 	) | ||||
| 	flag.IntVar(&webPort, "web-port", 8808, "port of the web server") | ||||
| 	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.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.BoolVar(&version, "version", false, "Print version and exit.") | ||||
|  | ||||
| 	flag.Parse() | ||||
|  | ||||
| 	if version { | ||||
| 		common.PrintVersionAndExit() | ||||
| 	} | ||||
|  | ||||
| 	router := mux.NewRouter() | ||||
|  | ||||
| 	subBaseLine := newSubBaseLine(mapDir) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user