fix: flag of version and help
This commit is contained in:
@@ -110,15 +110,17 @@ const defaultConfigFile = "./etc/capconf.yaml"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
cfile := flag.String("c", defaultConfigFile, "config file")
|
cfile := flag.String("c", defaultConfigFile, "config file")
|
||||||
pv := flag.Bool("version", false, "print version")
|
pv := flag.Bool("v", false, "print version")
|
||||||
ph := flag.Bool("help", false, "print help")
|
pversion := flag.Bool("version", false, "print version")
|
||||||
|
ph := flag.Bool("h", false, "print help")
|
||||||
|
phelp := flag.Bool("help", false, "print help")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
if *pv {
|
if *pv || *pversion {
|
||||||
fmt.Printf("OMC captrace version: %s\n%s\n%s\n\n", global.Version, global.BuildTime, global.GoVer)
|
fmt.Printf("OMC captrace version: %s\n%s\n%s\n\n", global.Version, global.BuildTime, global.GoVer)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
if *ph {
|
if *ph || *phelp {
|
||||||
flag.Usage()
|
flag.Usage()
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,14 +179,16 @@ var ConfigFile *string
|
|||||||
func init() {
|
func init() {
|
||||||
ConfigFile = flag.String("c", defaultConfigFile, "config file")
|
ConfigFile = flag.String("c", defaultConfigFile, "config file")
|
||||||
pv := flag.Bool("v", false, "print version")
|
pv := flag.Bool("v", false, "print version")
|
||||||
|
pversion := flag.Bool("version", false, "print version")
|
||||||
ph := flag.Bool("h", false, "print help")
|
ph := flag.Bool("h", false, "print help")
|
||||||
|
phelp := flag.Bool("help", false, "print help")
|
||||||
|
|
||||||
flag.Parse()
|
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)
|
fmt.Printf("OMC crontask version: %s\n%s\n%s\n\n", global.Version, global.BuildTime, global.GoVer)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
if *ph {
|
if *ph || *phelp {
|
||||||
flag.Usage()
|
flag.Usage()
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ case "$1" in
|
|||||||
;;
|
;;
|
||||||
version)
|
version)
|
||||||
for procName in $ProcList;do
|
for procName in $ProcList;do
|
||||||
$BinDir/$procName -v
|
$BinDir/$procName --version
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|||||||
@@ -167,14 +167,16 @@ const DefaultConfigFile = "./etc/sshsvc.yaml"
|
|||||||
func init() {
|
func init() {
|
||||||
cfile := flag.String("c", DefaultConfigFile, "config file")
|
cfile := flag.String("c", DefaultConfigFile, "config file")
|
||||||
pv := flag.Bool("v", false, "print version")
|
pv := flag.Bool("v", false, "print version")
|
||||||
|
pversion := flag.Bool("version", false, "print version")
|
||||||
ph := flag.Bool("h", false, "print help")
|
ph := flag.Bool("h", false, "print help")
|
||||||
|
phelp := flag.Bool("help", false, "print help")
|
||||||
|
|
||||||
flag.Parse()
|
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)
|
fmt.Printf("OMC sshsvc version: %s\n%s\n%s\n\n", global.Version, global.BuildTime, global.GoVer)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
if *ph {
|
if *ph || *phelp {
|
||||||
flag.Usage()
|
flag.Usage()
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user