Skip to content

Noblefel/vivi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Some helpers to get user input from terminal. Thanks to keyboard from atomicgo

go get github.com/Noblefel/vivi

Example: select from multiple choice

func main() {
	// basic
	fmt.Println("are you ready to play?")
	ready := vivi.Choices("Yes", "No")

	if ready == 1 {
		return
	}

	// slice
	fmt.Println("----------------")
	fmt.Println("which you like the most ?")

	foods := []string{
		"Burger 🍔",
		"Pizza 🍕",
		"Sushi 🍣",
		"Steak 🥩",
		"Spaghetti 🍝",
		"Fries 🍟",
	}

	fav := vivi.Choices(foods...)
	fmt.Println("me too like", foods[fav], "😋")
}

Example: passwords

func main() {
	fmt.Print("enter password please: ")
	pw := vivi.Password("*")

	if pw != "abc" {
		fmt.Println("wrong!!!")
		return
	}
}

Example: hidden input

func main() {
	fmt.Print("say something very secret: ")
	secret := vivi.Password("")
	fmt.Println("this secret is safe")
}

About

Some helpers to get user input from terminal. Thanks to keyboard from atomicgo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages