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-13 18:37:03 +03:00
|
|
|
Version bool
|
2019-01-04 10:41:01 +03:00
|
|
|
}
|
|
|
|
|
2019-01-04 15:02:17 +03:00
|
|
|
func Parse() ParamsType {
|
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-07 10:56:02 +03:00
|
|
|
flag.BoolVar(&(params.Version), "version", false, "Show version")
|
2019-01-04 10:41:01 +03:00
|
|
|
flag.Parse()
|
2019-01-04 12:44:41 +03:00
|
|
|
|
2019-01-04 15:02:17 +03:00
|
|
|
return params
|
2019-01-04 13:00:49 +03:00
|
|
|
}
|
2019-01-18 10:47:38 +03:00
|
|
|
|
|
|
|
func PrintHelp(){
|
|
|
|
flag.PrintDefaults()
|
|
|
|
}
|