mapserver/params/params.go

31 lines
468 B
Go
Raw Normal View History

2019-01-04 10:41:01 +03:00
package params
import (
"flag"
)
type ParamsType struct {
2019-01-04 12:44:41 +03:00
Worlddir string
2019-01-04 13:00:49 +03:00
Port int
Help bool
2019-01-04 10:41:01 +03:00
}
var params ParamsType
func Params() ParamsType {
return params
}
2019-01-04 13:00:49 +03:00
func Parse() {
2019-01-04 10:41:01 +03:00
params := ParamsType{}
2019-01-04 12:44:41 +03:00
flag.StringVar(&(params.Worlddir), "worlddir", "./", "world directory")
flag.IntVar(&(params.Port), "port", 8080, "port to use")
flag.BoolVar(&(params.Help), "help", false, "Show help")
2019-01-04 10:41:01 +03:00
flag.Parse()
2019-01-04 12:44:41 +03:00
2019-01-04 13:00:49 +03:00
if params.Help {
2019-01-04 12:44:41 +03:00
flag.PrintDefaults()
}
2019-01-04 13:00:49 +03:00
}