hautils

[hare] Set of POSIX utilities
Log | Files | Refs | README | LICENSE

commit 0d31e3a320640510549ee90a789a54b4eca49b81
parent 51d5cdd34c13550ba2ed4759bbdb58b29773437a
Author: Byron Torres <b@torresjrjr.com>
Date:   Fri, 10 Feb 2023 18:24:05 +0000

nl: update for regex::find

Signed-off-by: Byron Torres <b@torresjrjr.com>

Diffstat:
Mnl.ha | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/nl.ha b/nl.ha @@ -331,11 +331,10 @@ fn println(line: str, s: style, ctx: *context) (void | io::error) = { case none => fmt::printf("{%}{}", " ", ctx.mod, ctx.sepblank)?; case let re: regex::regex => - match (regex::find(&re, line)) { - case []regex::capture => + if (len(regex::find(&re, line)) > 0) { fmt::printf("{%}{}", ctx.linenum, ctx.mod, ctx.sep)?; ctx.linenum += ctx.incr; - case void => + } else { fmt::printf("{%}{}", " ", ctx.mod, ctx.sepblank)?; }; };