feat: add help option
This commit is contained in:
parent
5c98cb2615
commit
ab6f301467
1 changed files with 6 additions and 1 deletions
|
@ -11,6 +11,7 @@ import (
|
||||||
|
|
||||||
// Option to parse
|
// Option to parse
|
||||||
var (
|
var (
|
||||||
|
HELP = flag.Bool("help", false, "print the help message")
|
||||||
HOSTNAME = flag.String("hostname", "localhost", "mysql hostname")
|
HOSTNAME = flag.String("hostname", "localhost", "mysql hostname")
|
||||||
PORT = flag.Int("port", 3306, "mysql port")
|
PORT = flag.Int("port", 3306, "mysql port")
|
||||||
USERNAME = flag.String("username", "", "mysql username")
|
USERNAME = flag.String("username", "", "mysql username")
|
||||||
|
@ -24,6 +25,11 @@ var (
|
||||||
func init() {
|
func init() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
if *HELP {
|
||||||
|
flag.PrintDefaults()
|
||||||
|
os.Exit(3)
|
||||||
|
}
|
||||||
|
|
||||||
if *QUERY == "" {
|
if *QUERY == "" {
|
||||||
Critical("Please set query option")
|
Critical("Please set query option")
|
||||||
}
|
}
|
||||||
|
@ -87,4 +93,3 @@ func main() {
|
||||||
|
|
||||||
Ok(msg)
|
Ok(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue