aboutsummaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2024-07-04 23:06:15 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2024-07-04 23:06:15 +0300
commit5c76974cb0e7ab54ddd900785319e3ac6fd2ffa8 (patch)
tree910364449495427b6d2d537ebc770958e80374f8 /data
parentDistutilsNonPEP517Build: handle false positive with eclass defined (diff)
downloadpkgcheck-5c76974cb0e7ab54ddd900785319e3ac6fd2ffa8.tar.gz
pkgcheck-5c76974cb0e7ab54ddd900785319e3ac6fd2ffa8.tar.bz2
pkgcheck-5c76974cb0e7ab54ddd900785319e3ac6fd2ffa8.zip
bash-completion: use _filedir
This handles spaces and such much much better Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'data')
-rw-r--r--data/share/bash-completion/completions/pkgcheck30
1 files changed, 15 insertions, 15 deletions
diff --git a/data/share/bash-completion/completions/pkgcheck b/data/share/bash-completion/completions/pkgcheck
index 8801391b..972fc1e5 100644
--- a/data/share/bash-completion/completions/pkgcheck
+++ b/data/share/bash-completion/completions/pkgcheck
@@ -43,18 +43,15 @@ _pkgcheck() {
COMPREPLY=($(compgen -W "${base_options[*]}" -- "${cur}"))
# find the subcommand
- for ((i = 1; i < ${COMP_CWORD}; i++)); do
- case "${COMP_WORDS[i]}" in
- -*) ;;
- *)
- cmd=${COMP_WORDS[i]}
- break
- ;;
- esac
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ if [[ ${COMP_WORDS[i]} != -* ]]; then
+ cmd=${COMP_WORDS[i]}
+ break
+ fi
done
- if [[ ${i} == ${COMP_CWORD} ]]; then
- COMPREPLY+=($(compgen -W "${subcommands[*]}" -- "${cur}"))
+ if (( i == COMP_CWORD )); then
+ COMPREPLY+=($(compgen -W "${subcommands}" -- "${cur}"))
return
fi
@@ -73,7 +70,7 @@ _pkgcheck() {
case ${prev} in
--cache-dir)
- COMPREPLY=($(compgen -d -- "${cur}"))
+ _filedir -d
;;
-t | --type)
COMPREPLY=($(compgen -W "$(</usr/share/pkgcheck/caches)" -- "${cur}"))
@@ -90,7 +87,7 @@ _pkgcheck() {
case ${prev} in
--failures)
- COMPREPLY=($(compgen -f -- "${cur}"))
+ _filedir
;;
*)
COMPREPLY+=($(compgen -W "${subcmd_options[*]}" -- "${cur}"))
@@ -111,8 +108,11 @@ _pkgcheck() {
COMPREPLY=()
;;
*)
- COMPREPLY+=($(compgen -W "${subcmd_options[*]}" -- "${cur}"))
- COMPREPLY+=($(compgen -f -- "${cur}"))
+ if [[ ${cur} == -* ]]; then
+ COMPREPLY+=($(compgen -W "${subcmd_options[*]}" -- "${cur}"))
+ else
+ _filedir
+ fi
;;
esac
;;
@@ -146,7 +146,7 @@ _pkgcheck() {
COMPREPLY=()
;;
--cache-dir)
- COMPREPLY=($(compgen -d -- "${cur}"))
+ _filedir -d
;;
-r | --repo)
COMPREPLY=($(compgen -W "$(_parsereposconf -l)" -- "${cur}"))