aboutsummaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2014-03-14 17:02:20 +0100
committerUlrich Müller <ulm@gentoo.org>2014-03-14 17:10:34 +0100
commit6cfcd9b33e08157146d08783872635a0545f4ead (patch)
tree88cdf14ec391054b1285686b1183c915339e0f3e /libs
parentSuppress C and POSIX as languages in news module; support _<territory>. (diff)
downloadeselect-6cfcd9b33e08157146d08783872635a0545f4ead.tar.gz
eselect-6cfcd9b33e08157146d08783872635a0545f4ead.tar.bz2
eselect-6cfcd9b33e08157146d08783872635a0545f4ead.zip
Don't output spurious whitespace in write_kv_list_entry.
* libs/output.bash.in (write_kv_list_entry): Don't output spurious trailing whitespace if value is an empty string.
Diffstat (limited to 'libs')
-rw-r--r--libs/output.bash.in8
1 files changed, 7 insertions, 1 deletions
diff --git a/libs/output.bash.in b/libs/output.bash.in
index 140de9e..2681c8c 100644
--- a/libs/output.bash.in
+++ b/libs/output.bash.in
@@ -110,6 +110,13 @@ write_kv_list_entry() {
text=${key//\%%%??%%%/}
n=$(( 26 + ${#rindent} - ${#lindent} - ${#text} ))
+ text=${val//\%%%??%%%/}
+ if [[ -z ${text} ]]; then
+ # empty ${val}: end the line and be done
+ echo
+ return
+ fi
+
# if ${n} is less than or equal to zero then we have a long ${key}
# that will mess up the formatting of ${val}, so end the line, indent
# and let ${val} go on the next line. Don't start a new line when
@@ -126,7 +133,6 @@ write_kv_list_entry() {
echo -n -e "$(space ${n})${right}"
n=$(( 28 + ${#rindent} ))
- text=${val//\%%%??%%%/}
# only loop if it doesn't fit on the same line
if [[ $(( ${n} + ${#text} )) -ge ${cols} ]] && ! is_output_mode brief; then
local i=0 spc=""