fix: flag of version and help

This commit is contained in:
2024-10-12 16:24:27 +08:00
parent 747ee080c8
commit 495448254e
4 changed files with 15 additions and 9 deletions

View File

@@ -179,14 +179,16 @@ var ConfigFile *string
func init() {
ConfigFile = flag.String("c", defaultConfigFile, "config file")
pv := flag.Bool("v", false, "print version")
pversion := flag.Bool("version", false, "print version")
ph := flag.Bool("h", false, "print help")
phelp := flag.Bool("help", false, "print help")
flag.Parse()
if *pv {
if *pv || *pversion {
fmt.Printf("OMC crontask version: %s\n%s\n%s\n\n", global.Version, global.BuildTime, global.GoVer)
os.Exit(0)
}
if *ph {
if *ph || *phelp {
flag.Usage()
os.Exit(0)
}