more terminal utility functions
This commit is contained in:
		| @@ -2,6 +2,7 @@ package cardsim | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"os" | ||||
| 	"strconv" | ||||
| 	"strings" | ||||
| ) | ||||
| @@ -123,3 +124,22 @@ func pickNextAction[C StatsCollection](p *Player[C]) (isCard bool, cardIdx int, | ||||
| func cls() { | ||||
| 	fmt.Println("\033[H\033[2J") | ||||
| } | ||||
|  | ||||
| func divider() { | ||||
| 	fmt.Println() | ||||
| 	fmt.Println(SectionBreak.String()) | ||||
| 	fmt.Println() | ||||
| } | ||||
|  | ||||
| func confirmQuit() { | ||||
| 	divider() | ||||
| 	fmt.Println("Are you sure you want to quit? (Y/N) ") | ||||
| 	var s string | ||||
| 	fmt.Scanln(&s) | ||||
| 	s = strings.TrimSpace(s) | ||||
| 	s = strings.ToLower(s) | ||||
| 	if strings.HasPrefix(s, "y") { | ||||
| 		fmt.Println("Bye!") | ||||
| 		os.Exit(0) | ||||
| 	} | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user