util

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2023 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OptYes = 0
	OptNo  = 1
)

Variables

View Source
var YesNoOpts = []InputOption{"Yes", "No"}

Functions

func GetCLIInputStr

func GetCLIInputStr(prompt string) string

func GetCLIIntRange

func GetCLIIntRange(lo, hi int) int

getIntRange prompts the user to input an integer between LO and HI.

func GetCLIOption

func GetCLIOption(prompt string, options []InputOption) int

func GetCLIOptionMap

func GetCLIOptionMap(prompt string, options map[string]string, quitKey, quit string) string

func GetCLIYesNo

func GetCLIYesNo(prompt string) int

func IfThenElse

func IfThenElse[T any](cond bool, ifVal, elseVal T) T

func IfThenElseFn

func IfThenElseFn[T any](cond bool, ifFn, elseFn func() T) T

func NormalizeNumStr

func NormalizeNumStr(s string) string

Types

type InputOption

type InputOption = string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL