summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>2009-12-26 21:36:18 +0000
committerArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>2009-12-26 21:36:18 +0000
commit6c330c02f50d8f9fba32e332fe81a262f7c7f8cd (patch)
tree9385896a4b8d7cb994ad746c78eaea85f6fa5b9b
parentAdd support for --python2 / --python3 options (bug #296220). (diff)
downloadeselect-python-6c330c02f50d8f9fba32e332fe81a262f7c7f8cd.tar.gz
eselect-python-6c330c02f50d8f9fba32e332fe81a262f7c7f8cd.tar.bz2
eselect-python-6c330c02f50d8f9fba32e332fe81a262f7c7f8cd.zip
Support `eselect --brief python list` (bug #292112).
-rw-r--r--python.eselect20
1 files changed, 8 insertions, 12 deletions
diff --git a/python.eselect b/python.eselect
index 3e8cdd3..8556a68 100644
--- a/python.eselect
+++ b/python.eselect
@@ -198,7 +198,7 @@ describe_list_options() {
}
do_list() {
- local python_descriptive_name="Python" python_version_option= python2="0" python3="0" targets=()
+ local active i python_descriptive_name="Python" python_version_option= python2="0" python3="0" targets=()
while [[ $# > 0 ]]; do
case "$1" in
--python2)
@@ -228,17 +228,13 @@ do_list() {
write_list_start "Available ${python_descriptive_name} interpreters:"
- if [[ -n ${targets[@]} ]]; then
- # mark the active python
- local i active=$(do_show ${python_version_option})
- for ((i = 0; i < ${#targets[@]}; i = i + 1)); do
- [[ ${targets[${i}]} == ${active} ]] && \
- targets[${i}]="${targets[${i}]} $(highlight '*')"
- done
- write_numbered_list "${targets[@]}"
- else
- write_kv_list_entry "(none found)" ""
- fi
+ active="$(do_show ${python_version_option})"
+ for ((i = 0; i < ${#targets[@]}; i++)); do
+ if [[ ${targets[${i}]} == ${active} ]]; then
+ targets[${i}]="$(highlight_marker "${targets[${i}]}")"
+ fi
+ done
+ write_numbered_list -m "(none found)" "${targets[@]}"
}
### set action ###