aboutsummaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2013-11-14 23:56:29 +0100
committerUlrich Müller <ulm@gentoo.org>2013-11-15 09:01:31 +0100
commit7e66a8cfbe7c3ca2b56aae3f4de648875d29241f (patch)
tree57e2716cffb3208795ac1909b9db5d8ca3ce3bbc /libs
parentMore cosmetic changes in output.bash. (diff)
downloadeselect-7e66a8cfbe7c3ca2b56aae3f4de648875d29241f.tar.gz
eselect-7e66a8cfbe7c3ca2b56aae3f4de648875d29241f.tar.bz2
eselect-7e66a8cfbe7c3ca2b56aae3f4de648875d29241f.zip
Suppress wrapping of lines in brief output mode, bug 490882.
* libs/output.bash.in (write_kv_list_entry): Suppress wrapping of lines in brief output mode, in order to make automatic parsing easier. Bug 490882.
Diffstat (limited to 'libs')
-rw-r--r--libs/output.bash.in13
1 files changed, 9 insertions, 4 deletions
diff --git a/libs/output.bash.in b/libs/output.bash.in
index 5390792..92c367b 100644
--- a/libs/output.bash.in
+++ b/libs/output.bash.in
@@ -112,10 +112,15 @@ write_kv_list_entry() {
# 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.
+ # and let ${val} go on the next line. Don't start a new line when
+ # in brief output mode, in order to keep the output easily parsable.
if [[ ${n} -le 0 ]]; then
- echo
- n=$(( 28 + ${#rindent} ))
+ if is_output_mode brief; then
+ n=1
+ else
+ echo
+ n=$(( 28 + ${#rindent} ))
+ fi
fi
echo -n -e "$(space ${n})${right}"
@@ -123,7 +128,7 @@ write_kv_list_entry() {
text=${val//\%%%??%%%/}
# only loop if it doesn't fit on the same line
- if [[ $(( ${n} + ${#text} )) -ge ${cols} ]]; then
+ if [[ $(( ${n} + ${#text} )) -ge ${cols} ]] && ! is_output_mode brief; then
local i=0 spc=""
rindent=$(space ${n})
local cwords=( $(apply_text_highlights "${right}" "${val}") )