master > master: code go - cleanup von cli + option, um checks ein+auszuschalten

This commit is contained in:
RD
2021-11-02 09:07:04 +01:00
parent 8cd99c1632
commit fce25de013
15 changed files with 353 additions and 111 deletions

View File

@@ -94,3 +94,17 @@ func FormatTextBlockAsList(text string, options ...bool) []string {
func StripAnsi(text string) string {
return re.Sub(`\x1b[^m]*m`, ``, text)
}
/* ---------------------------------------------------------------- *
* METHODS string -> bool
* ---------------------------------------------------------------- */
func IsTrue(text string) bool {
text = strings.TrimSpace(text)
return re.Matches(`(?i)(^(true|t|yes|y|1|\+|\+1)$)`, text)
}
func IsFalse(text string) bool {
text = strings.TrimSpace(text)
return re.Matches(`(?i)(^(false|f|no|n|0|-|-1)$)`, text)
}