trunk
vilmibm 2020-10-27 05:10:37 +00:00
parent 3028053299
commit 74e0f72f9b
1 changed files with 8 additions and 8 deletions

16
main.go
View File

@ -22,7 +22,7 @@ func main() {
case "-r", "--random":
err = visitRandomUser()
default:
err = visitUser(os.Args[1])
err = visitUsername(os.Args[1])
}
} else {
err = visitPrompt()
@ -41,12 +41,10 @@ func visitRandomUser() error {
return err
}
fmt.Println("TODO show", usernames[rand.Intn(len(usernames))])
return nil
return visitUser(usernames[rand.Intn(len(usernames))])
}
func visitUser(username string) error {
func visitUsername(username string) error {
usernames, err := getUsernames()
if err != nil {
return err
@ -54,8 +52,7 @@ func visitUser(username string) error {
for _, name := range usernames {
if name == username {
fmt.Println("TODO visit", name)
return nil
return visitUser(username)
}
}
@ -73,8 +70,11 @@ func visitPrompt() error {
Options: usernames,
}
survey.AskOne(prompt, &username)
fmt.Println("TODO visit", username)
return visitUser(username)
}
func visitUser(username string) error {
fmt.Println("TODO visit", username)
return nil
}