From ca051b06a95b856cd3cb033bbef5ae2ea66f89f3 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 12 Oct 2024 15:33:53 -0300 Subject: src/pre: Add "-n" to prevent ":" output --- src/pre | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/pre') diff --git a/src/pre b/src/pre index 7ba0c47..d593ad2 100755 --- a/src/pre +++ b/src/pre @@ -9,10 +9,25 @@ usage() { } +SEP=: +while getopts 'n' flag; do + case "$flag" in + (n) + SEP= + ;; + (*) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + PREFIX="${1:-}" eval "$(assert-arg -- "$PREFIX" 'PREFIX')" # FIXME: using "while" so we avoid GNU sed's buffering while read -r line; do - printf '%s: %s\n' "$PREFIX" "$line" + printf '%s%s %s\n' "$PREFIX" "$SEP" "$line" done -- cgit v1.2.3