1 Commits
0.10.1 ... main

Author SHA1 Message Date
c0e96f99a8 Add termFmt to increase capabilities from withColor. 2025-11-19 16:57:18 -06:00
2 changed files with 7 additions and 6 deletions

View File

@@ -22,12 +22,13 @@ proc termColor*(color: TermColor, bright, bold = false): string =
return "\e[" & $colorVal & (if bold: ";1" else: "") & "m" return "\e[" & $colorVal & (if bold: ";1" else: "") & "m"
proc withColor*(str: string, color: TermColor, bright, bold, skipReset = false): string = proc termFmt*(str: string, color: TermColor, bright, bold, underline, skipReset = false): string =
if skipReset: result = termColor(color, bright, bold) & str
return termColor(color, bright, bold) & str if underline: result = "\e[4m" & result
else: if not skipReset: result &= termReset
return termColor(color, bright, bold) & str & termReset
proc withColor*(str: string, color: TermColor, bright, bold, skipReset = false): string =
termFmt(str, color, bright, bold, false, skipReset)
proc stripAnsi*(str: string): string = proc stripAnsi*(str: string): string =
let STRIP_ANSI_REGEX = re"\x1B\[([0-9]{1,2}(;[0-9]{0,2})?)?[m|K]" let STRIP_ANSI_REGEX = re"\x1B\[([0-9]{1,2}(;[0-9]{0,2})?)?[m|K]"

View File

@@ -1,6 +1,6 @@
# Package # Package
version = "0.10.1" version = "0.10.2"
author = "Jonathan Bernard" author = "Jonathan Bernard"
description = "Helper functions for writing command line interfaces." description = "Helper functions for writing command line interfaces."
license = "MIT" license = "MIT"