diff options
author | 2014-03-14 17:02:20 +0100 | |
---|---|---|
committer | 2014-03-14 17:10:34 +0100 | |
commit | 6cfcd9b33e08157146d08783872635a0545f4ead (patch) | |
tree | 88cdf14ec391054b1285686b1183c915339e0f3e /libs | |
parent | Suppress C and POSIX as languages in news module; support _<territory>. (diff) | |
download | eselect-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.in | 8 |
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="" |