summaryrefslogtreecommitdiffstats
path: root/completions/update-alternatives
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:19 +0000
commit6c09f2a45c5541e9c207d14fc7aa21a4a0066bde (patch)
tree0221189d367bf661f6f9493c4f17a03f0dd4b7d2 /completions/update-alternatives
parentReleasing progress-linux version 1:2.11-8~progress7.99u1. (diff)
downloadbash-completion-6c09f2a45c5541e9c207d14fc7aa21a4a0066bde.tar.xz
bash-completion-6c09f2a45c5541e9c207d14fc7aa21a4a0066bde.zip
Merging upstream version 1:2.12.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'completions/update-alternatives')
-rw-r--r--completions/update-alternatives36
1 files changed, 18 insertions, 18 deletions
diff --git a/completions/update-alternatives b/completions/update-alternatives
index 25d2ce6..0d678fc 100644
--- a/completions/update-alternatives
+++ b/completions/update-alternatives
@@ -1,8 +1,8 @@
# bash completion for update-alternatives -*- shell-script -*-
-_installed_alternatives()
+_comp_cmd_update_alternatives__installed()
{
- local admindir
+ local i admindir
# find the admin dir
for i in alternatives dpkg/alternatives rpm/alternatives; do
[[ -d /var/lib/$i ]] && admindir=/var/lib/$i && break
@@ -13,17 +13,17 @@ _installed_alternatives()
break
fi
done
- COMPREPLY=($(compgen -W '$(command ls $admindir)' -- "$cur"))
+ [[ -d $admindir ]] && _comp_compgen_split -- "$(command ls "$admindir")"
}
-_update_alternatives()
+_comp_cmd_update_alternatives()
{
- local cur prev words cword
- _init_completion || return
+ local cur prev words cword comp_args
+ _comp_initialize -- "$@" || return
case $prev in
--altdir | --admindir)
- _filedir -d
+ _comp_compgen_filedir -d
return
;;
--help | --usage | --version)
@@ -31,7 +31,7 @@ _update_alternatives()
;;
esac
- local mode args i
+ local mode="" args i
# find which mode to use and how many real args used so far
for ((i = 1; i < cword; i++)); do
@@ -46,10 +46,10 @@ _update_alternatives()
--install)
case $args in
1 | 3)
- _filedir
+ _comp_compgen_filedir
;;
2)
- _installed_alternatives
+ _comp_cmd_update_alternatives__installed
;;
4)
# priority - no completions
@@ -57,13 +57,13 @@ _update_alternatives()
*)
case $((args % 4)) in
0 | 2)
- _filedir
+ _comp_compgen_filedir
;;
1)
- COMPREPLY=($(compgen -W '--slave' -- "$cur"))
+ _comp_compgen -- -W '--slave'
;;
3)
- _installed_alternatives
+ _comp_cmd_update_alternatives__installed
;;
esac
;;
@@ -72,21 +72,21 @@ _update_alternatives()
--remove | --set)
case $args in
1)
- _installed_alternatives
+ _comp_cmd_update_alternatives__installed
;;
2)
- _filedir
+ _comp_compgen_filedir
;;
esac
;;
--auto | --remove-all | --display | --config)
- _installed_alternatives
+ _comp_cmd_update_alternatives__installed
;;
*)
- COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur"))
+ _comp_compgen_help
;;
esac
} &&
- complete -F _update_alternatives update-alternatives alternatives
+ complete -F _comp_cmd_update_alternatives update-alternatives alternatives
# ex: filetype=sh