summaryrefslogtreecommitdiff
path: root/src/lib/libremessages
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libremessages')
-rwxr-xr-xsrc/lib/libremessages18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/lib/libremessages b/src/lib/libremessages
index db2fdde..f75bd4a 100755
--- a/src/lib/libremessages
+++ b/src/lib/libremessages
@@ -47,7 +47,7 @@ panic() {
exit 1
}
-# Usage: print MESG ARG1 ARG2...
+# Usage: print MESG [ARGS...]
# Like printf, but gettext-aware, and prints a trailing newline
print() {
[[ $# -ge 1 ]] || panic
@@ -58,28 +58,28 @@ print() {
# Do HTML-style whitespace collapsing on standard IO.
# It considers newline, tab, and space to be whitespace.
-_html_whitespace_collapse() {
+_libremessages_html_whitespace_collapse() {
[[ $# == 0 ]] || panic
tr '\n' ' ' | sed -r -e 's/\t/ /g' -e 's/ +/ /g'
}
-# Usage: prose MESG
+# Usage: prose MESG [ARGS...]
# Do HTML-style whitespace collapsing on the first argument, translate it
# (gettext), then word-wrap it to 75 columns.
# This is useful for printing a paragraph of prose in --help text.
prose() {
[[ $# -ge 1 ]] || panic
- local mesg="$(_ "$(_html_whitespace_collapse <<<"$1")")"; shift
+ local mesg="$(_ "$(_libremessages_html_whitespace_collapse <<<"$1")")"; shift
printf -- "$mesg" "$@" | fmt -u
}
-# Usage: bullet MESG
+# Usage: bullet MESG [ARGS...]
# Like prose, but print a bullet "-" before the first line, and indent the
# remaining lines.
bullet() {
[[ $# -ge 1 ]] || panic
- local mesg="$(_ "$(_html_whitespace_collapse <<<"$1")")"; shift
+ local mesg="$(_ "$(_libremessages_html_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/^/ /'
}
@@ -96,7 +96,7 @@ bullet() {
flag() {
[[ $# == 2 ]] || panic
local flag=$1
- local desc="$(_ "$(_html_whitespace_collapse <<<"$2")")"
+ local desc="$(_ "$(_libremessages_html_whitespace_collapse <<<"$2")")"
declare -i indent=13
while [[ $indent -le ${#flag} ]]; do
@@ -162,7 +162,5 @@ setup_traps() {
if [[ "${0##*/}" == libremessages ]]; then
set -euE
- _libremessages_cmd=$1
- shift
- "$_libremessages_cmd" "$@"
+ "$@"
fi