fix: flag to output version of bin

This commit is contained in:
2024-10-12 15:47:41 +08:00
parent f01b0b9da0
commit 003d26bce3
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)
}