mirror of
https://github.com/quitesimpleorg/hs9001.git
synced 2024-11-22 09:47:51 +01:00
Don't crash when no arguments are given
This commit is contained in:
parent
c271bc986d
commit
a2bcc9685a
6
main.go
6
main.go
@ -112,6 +112,12 @@ func main() {
|
|||||||
flag.Parse()
|
flag.Parse()
|
||||||
args := flag.Args()
|
args := flag.Args()
|
||||||
argslen := len(args)
|
argslen := len(args)
|
||||||
|
|
||||||
|
if argslen < 1 {
|
||||||
|
fmt.Fprintf(os.Stderr, "Usage: ./hs9001 <add/search/init>\n")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
cmd := args[0]
|
cmd := args[0]
|
||||||
|
|
||||||
if cmd == "add" {
|
if cmd == "add" {
|
||||||
|
Loading…
Reference in New Issue
Block a user