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