summaryrefslogtreecommitdiff
path: root/src/pre
diff options
context:
space:
mode:
Diffstat (limited to 'src/pre')
-rwxr-xr-xsrc/pre17
1 files changed, 16 insertions, 1 deletions
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