more terminal utility functions
This commit is contained in:
parent
c73545fd07
commit
3eb087201f
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user