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
|
||||
var (
|
||||
HELP = flag.Bool("help", false, "print the help message")
|
||||
HOSTNAME = flag.String("hostname", "localhost", "mysql hostname")
|
||||
PORT = flag.Int("port", 3306, "mysql port")
|
||||
USERNAME = flag.String("username", "", "mysql username")
|
||||
|
@ -24,6 +25,11 @@ var (
|
|||
func init() {
|
||||
flag.Parse()
|
||||
|
||||
if *HELP {
|
||||
flag.PrintDefaults()
|
||||
os.Exit(3)
|
||||
}
|
||||
|
||||
if *QUERY == "" {
|
||||
Critical("Please set query option")
|
||||
}
|
||||
|
@ -87,4 +93,3 @@ func main() {
|
|||
|
||||
Ok(msg)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue