diff --git a/main.go b/main.go index 0db9327..6679ae7 100644 --- a/main.go +++ b/main.go @@ -6,4 +6,8 @@ import ( func main(){ params.Parse() + p := params.Params() + if (p.Help){ + return + } } \ No newline at end of file diff --git a/params/params.go b/params/params.go index be17f6d..93c6aed 100644 --- a/params/params.go +++ b/params/params.go @@ -2,11 +2,12 @@ package params import ( "flag" - "fmt" ) type ParamsType struct { - worlddir string + Worlddir string + Port int + Help bool } var params ParamsType @@ -17,7 +18,13 @@ func Params() ParamsType { func Parse(){ 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() - fmt.Println("World dir is: ", params.worlddir) + + if (params.Help) { + flag.PrintDefaults() + } } \ No newline at end of file diff --git a/worldconfig/parse.go b/worldconfig/parse.go new file mode 100644 index 0000000..3c6ffd6 --- /dev/null +++ b/worldconfig/parse.go @@ -0,0 +1,7 @@ + +type WorldConfig struct { +} + +func Parse(data []byte) WorldConfig { + +} \ No newline at end of file