From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 8E8B11392EF for ; Fri, 14 Mar 2014 19:43:29 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1DAF7E0A64; Fri, 14 Mar 2014 19:43:29 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 9DFE7E0A64 for ; Fri, 14 Mar 2014 19:43:28 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C53F033F8DF for ; Fri, 14 Mar 2014 19:43:27 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id D009918875 for ; Fri, 14 Mar 2014 19:43:25 +0000 (UTC) From: "Ulrich Müller" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Müller" Message-ID: <1394813434.6cfcd9b33e08157146d08783872635a0545f4ead.ulm@gentoo> Subject: [gentoo-commits] proj/eselect:master commit in: libs/, / X-VCS-Repository: proj/eselect X-VCS-Files: ChangeLog libs/output.bash.in X-VCS-Directories: libs/ / X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Müller X-VCS-Revision: 6cfcd9b33e08157146d08783872635a0545f4ead X-VCS-Branch: master Date: Fri, 14 Mar 2014 19:43:25 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 17f92458-cebd-4085-beba-3ac7b6db426d X-Archives-Hash: 749a219b9dd3e307cec0d7c552b31085 commit: 6cfcd9b33e08157146d08783872635a0545f4ead Author: Ulrich Müller gentoo org> AuthorDate: Fri Mar 14 16:02:20 2014 +0000 Commit: Ulrich Müller gentoo org> CommitDate: Fri Mar 14 16:10:34 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/eselect.git;a=commit;h=6cfcd9b3 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. --- ChangeLog | 5 +++++ libs/output.bash.in | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6aad604..0566eeb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-03-14 Ulrich Müller + + * libs/output.bash.in (write_kv_list_entry): Don't output spurious + trailing whitespace if value is an empty string. + 2014-02-25 Ulrich Müller * modules/news.eselect (accepted_languages): Suppress "C" 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=""