2019-01-04 10:41:01 +03:00
|
|
|
package params
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ParamsType struct {
|
2019-02-07 10:02:13 +03:00
|
|
|
Help bool
|
|
|
|
Version bool
|
|
|
|
Debug 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.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-18 16:23:33 +03:00
|
|
|
flag.BoolVar(&(params.Debug), "debug", false, "enable debug log")
|
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
|
|
|
|
2019-01-18 11:13:37 +03:00
|
|
|
func PrintHelp() {
|
2019-01-18 10:47:38 +03:00
|
|
|
flag.PrintDefaults()
|
|
|
|
}
|