summaryrefslogtreecommitdiff
path: root/src/lib/libremessages
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libremessages')
-rwxr-xr-xsrc/lib/libremessages9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/libremessages b/src/lib/libremessages
index f6deac8..4bea486 100755
--- a/src/lib/libremessages
+++ b/src/lib/libremessages
@@ -58,11 +58,12 @@ print() {
printf -- "$mesg\n" "$@"
}
-# Usage: _libremessages_html_whitespace_collapse <<<STRING
+# Usage: whitespace-collapse <<<STRING
#
# Collapses whitespace on stadard I/O, similar to HTML whitespace
# collapsing, with the exception that it puts two spaces between
# sentences. It considers newline, tab, and space to be whitespace.
+whitespace-collapse() {
[[ $# == 0 ]] || panic
tr '\n' '\r' | sed -r \
@@ -78,7 +79,7 @@ print() {
# printing a paragraph of prose in --help text.
prose() {
[[ $# -ge 1 ]] || panic
- local mesg="$(_ "$(_libremessages_html_whitespace_collapse <<<"$1")")"; shift
+ local mesg="$(_ "$(whitespace-collapse <<<"$1")")"; shift
printf -- "$mesg" "$@" | fmt -u
}
@@ -87,7 +88,7 @@ prose() {
# remaining lines.
bullet() {
[[ $# -ge 1 ]] || panic
- local mesg="$(_ "$(_libremessages_html_whitespace_collapse <<<"$1")")"; shift
+ local mesg="$(_ "$(whitespace-collapse <<<"$1")")"; shift
# Wrap the text to 71 columns; 75 (the default) minus a 4 column indent
printf -- "$mesg" "$@" | fmt -u -w 71 | sed -e '1s/^/ - /' -e '2,$s/^/ /'
}
@@ -140,7 +141,7 @@ flag() {
while [[ $# -gt 0 ]]; do
local flag=$1
- local desc="$(_ "$(_libremessages_html_whitespace_collapse <<<"$2")")"
+ local desc="$(_ "$(whitespace-collapse <<<"$2")")"
shift 2
local lines