fix args checking for chpass.

from ptd
This commit is contained in:
Ted Unangst 2022-11-22 13:06:57 -05:00
parent 2aa53ec46e
commit 565a286ff0
2 changed files with 7 additions and 7 deletions

View File

@ -373,7 +373,11 @@ func main() {
} }
deluser(args[1]) deluser(args[1])
case "chpass": case "chpass":
chpass() if len(args) < 2 {
fmt.Printf("usage: honk chpass username\n")
return
}
chpass(args[1])
case "cleanup": case "cleanup":
arg := "30" arg := "30"
if len(args) > 1 { if len(args) > 1 {

View File

@ -255,12 +255,8 @@ func deluser(username string) {
doordie(db, "delete from users where userid = ?", userid) doordie(db, "delete from users where userid = ?", userid)
} }
func chpass() { func chpass(username string) {
if len(os.Args) < 3 { user, err := butwhatabout(username)
fmt.Printf("need a username\n")
os.Exit(1)
}
user, err := butwhatabout(os.Args[2])
if err != nil { if err != nil {
elog.Fatal(err) elog.Fatal(err)
} }