1
0
forked from MTSR/mapserver

world config

This commit is contained in:
Thomas Rudin 2019-01-04 10:44:41 +01:00
parent e4ca34696e
commit f388e56fe8
3 changed files with 22 additions and 4 deletions

View File

@ -6,4 +6,8 @@ import (
func main(){ func main(){
params.Parse() params.Parse()
p := params.Params()
if (p.Help){
return
}
} }

View File

@ -2,11 +2,12 @@ package params
import ( import (
"flag" "flag"
"fmt"
) )
type ParamsType struct { type ParamsType struct {
worlddir string Worlddir string
Port int
Help bool
} }
var params ParamsType var params ParamsType
@ -17,7 +18,13 @@ func Params() ParamsType {
func Parse(){ func Parse(){
params := ParamsType{} params := ParamsType{}
flag.StringVar(&(params.worlddir), "worlddir", "./", "world directory")
flag.StringVar(&(params.Worlddir), "worlddir", "./", "world directory")
flag.IntVar(&(params.Port), "port", 8080, "port to use")
flag.BoolVar(&(params.Help), "help", false, "Show help")
flag.Parse() flag.Parse()
fmt.Println("World dir is: ", params.worlddir)
if (params.Help) {
flag.PrintDefaults()
}
} }

7
worldconfig/parse.go Normal file
View File

@ -0,0 +1,7 @@
type WorldConfig struct {
}
func Parse(data []byte) WorldConfig {
}