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])
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 {

View File

@ -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)
}