fix: flag to output version of bin

This commit is contained in:
simonzhangsz committed 2024-10-12 15:47:41 +08:00
1 parent f01b0b9da0
commit 003d26bce3
4 files changed
+15 -9

No files matched your search

+4 -2
View File
@@ -167,14 +167,16 @@ const DefaultConfigFile = "./etc/sshsvc.yaml"
func init() {
cfile := 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 sshsvc 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)
}