summaryrefslogtreecommitdiffstats
path: root/completions/pkg-get
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/pkg-get
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/pkg-get')
-rw-r--r--completions/pkg-get44
1 files changed, 22 insertions, 22 deletions
diff --git a/completions/pkg-get b/completions/pkg-get
index 72bd0a0..a8ec1a8 100644
--- a/completions/pkg-get
+++ b/completions/pkg-get
@@ -2,10 +2,10 @@
#
# Copyright 2006 Yann Rouillard <yann@opencsw.org>
-_pkg_get_get_catalog_file()
+_comp_cmd_pkg_get__catalog_file()
{
local url="$1"
- local catalog_file i conffile
+ local i conffile
for file in /etc/opt/csw/pkg-get.conf /opt/csw/etc/pkg-get.conf /etc/pkg-get.conf; do
if [[ -f $file ]]; then
@@ -15,19 +15,17 @@ _pkg_get_get_catalog_file()
done
conffile="${conffile:-/opt/csw/etc/pkg-get.conf}"
- if [[ -z $url ]]; then
- url=$(awk -F= ' $1=="url" { print $2 }' $conffile)
+ if [[ ! $url ]]; then
+ url=$(_comp_awk -F = ' $1=="url" { print $2 }' "$conffile")
fi
- catalog_file="${url##*//}"
- catalog_file="${catalog_file%%/*}"
- catalog_file="/var/pkg-get/catalog-$catalog_file"
-
- echo "$catalog_file"
+ REPLY="${url##*//}"
+ REPLY="${REPLY%%/*}"
+ REPLY="/var/pkg-get/catalog-$REPLY"
} &&
- _pkg_get()
+ _comp_cmd_pkg_get()
{
- local cur prev file catalog_file url command
+ local cur prev file url command=""
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD - 1]}"
@@ -46,27 +44,29 @@ _pkg_get_get_catalog_file()
fi
done
- if [[ -v command ]]; then
+ if [[ $command ]]; then
if [[ $command == @(-[Ddi]|describe|download|install) ]]; then
- catalog_file=$(_pkg_get_get_catalog_file "$url")
- if [[ -f $catalog_file ]]; then
- local packages_list=$(awk ' $0 ~ /BEGIN PGP SIGNATURE/ { exit } $1 ~ /^Hash:/ || $1 ~ /^ *(-|#|$)/ { next } { print $1 }' $catalog_file)
- COMPREPLY=($(compgen -W "${packages_list}" -- ${cur}))
+ local REPLY
+ _comp_cmd_pkg_get__catalog_file "$url"
+ if [[ -f $REPLY ]]; then
+ local packages_list=$(_comp_awk '$0 ~ /BEGIN PGP SIGNATURE/ { exit } $1 ~ /^Hash:/ || $1 ~ /^ *(-|#|$)/ { next } { print $1 }' "$REPLY")
+ _comp_compgen -- -W "${packages_list}"
fi
fi
return
fi
if [[ ${cur} == -* ]]; then
- local opts="-c -d -D -f -i -l -s -S -u -U -v"
- COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ local -a opts=(-c -d -D -f -i -l -s -S -u -U -v)
+ _comp_compgen -- -W '"${opts[@]}"'
return
fi
- local commands="available describe download install list \
- updatecatalog upgrade"
- COMPREPLY=($(compgen -W "${commands}" -- ${cur}))
+ local -a commands=(
+ available describe download install list updatecatalog upgrade
+ )
+ _comp_compgen -- -W '"${commands[@]}"'
} &&
- complete -F _pkg_get pkg-get
+ complete -F _comp_cmd_pkg_get pkg-get
# ex: filetype=sh