diff --git a/honk.go b/honk.go index dae5072..e000e21 100644 --- a/honk.go +++ b/honk.go @@ -373,7 +373,11 @@ func main() { } deluser(args[1]) case "chpass": - chpass() + if len(args) < 2 { + fmt.Printf("usage: honk chpass username\n") + return + } + chpass(args[1]) case "cleanup": arg := "30" if len(args) > 1 { diff --git a/util.go b/util.go index fe804a3..6919296 100644 --- a/util.go +++ b/util.go @@ -255,12 +255,8 @@ func deluser(username string) { doordie(db, "delete from users where userid = ?", userid) } -func chpass() { - if len(os.Args) < 3 { - fmt.Printf("need a username\n") - os.Exit(1) - } - user, err := butwhatabout(os.Args[2]) +func chpass(username string) { + user, err := butwhatabout(username) if err != nil { elog.Fatal(err) }