Documentation
¶
Index ¶
- func CheckYes(scnr scanner, msg string, defaultYes bool) bool
- func GetInputInt(scnr scanner, msg string, def int) int
- func GetInputString(scnr scanner, msg, def string) string
- func StringInSlice(a string, b []string) bool
- func StringSliceEqual(a []string, b []string) bool
- type Clock
- type MockClock
- type RealClock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckYes ¶
CheckYes takes a message string to present to the user and a boolen value representing the default value. It scans input for text. If the input value is empty, the default value is returned. If the input is either "y", "yes" (any case) true is returned. Otherwise, false is returned.
func GetInputInt ¶
GetInputInt takes a message string to present to the user and a default value. It scans input for text and attempts to convert the input to an integer. If the conversion to an integer fails, the user will be prompted to input an integer again. If the input value is empty, the default value is returned. Otherwise, the converted integer is returned.
func GetInputString ¶
GetInputString takes a message string to present to the user and a default value. It scans input for text. If the input value is empty, the default value is returned. Otherwise, the input string is returned.
func StringInSlice ¶
StringInSlice takes a string and a string slice. If the string is equal to any value in the string slice, true is returned. Otherwise, false is returned.
func StringSliceEqual ¶
StringSliceEqual takes two string slices and compares all slice values are equal. If all values are equal, true is returned. Otherwise, false is returned.