diff options
author | Ulrich Müller <ulm@gentoo.org> | 2009-09-19 05:42:06 +0000 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2009-09-19 05:42:06 +0000 |
commit | 9fd03936f3e3395d82d690fd7426425296f2a1c2 (patch) | |
tree | 06e5fa1c4a065e7f4dc1d7afc393dd3b3325dbb9 /libs | |
parent | Rename a variable. (diff) | |
download | eselect-9fd03936f3e3395d82d690fd7426425296f2a1c2.tar.gz eselect-9fd03936f3e3395d82d690fd7426425296f2a1c2.tar.bz2 eselect-9fd03936f3e3395d82d690fd7426425296f2a1c2.zip |
New -m option for function write_numbered_list.
svn path=/trunk/; revision=661
Diffstat (limited to 'libs')
-rw-r--r-- | libs/output.bash.in | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/libs/output.bash.in b/libs/output.bash.in index c235246..1a297d1 100644 --- a/libs/output.bash.in +++ b/libs/output.bash.in @@ -168,20 +168,28 @@ write_numbered_list_entry() { echo -n -e "${right}" echo -n -e "$(apply_text_highlights "${right}" "$2")" - echo -n -e "${normal}" - echo + echo -e "${normal}" } # write_numbered_list PUBLIC # Write out a numbered list. Args may include text highlighting. +# If called with the -m option and an empty list, output a negative report. write_numbered_list() { - local n=1 p= - if [[ ${1} == "-p" ]] ; then - p="-p" + local n=1 m p + while [[ $1 == -* ]]; do + case $1 in + "-m") shift; m=$1 ;; + "-p") p="-p" ;; + "--") shift; break ;; + esac shift + done + + if [[ $# -eq 0 && -n ${m} && ${ESELECT_OUTPUT_MODE} != brief ]]; then + write_kv_list_entry ${p} "${m}" "" fi - while [[ ${#@} -gt 0 ]] ; do + while [[ $# -gt 0 ]] ; do item=${1} shift if [[ ${item##*\\} == "" ]] ; then |