master > master: code go - cleanup von cli + option, um checks ein+auszuschalten
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user