summaryrefslogtreecommitdiffstats
path: root/completions/export
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:18 +0000
commitf4acb49ea148cdd899f7f29f1591c7bc853c2135 (patch)
treeb62d60873864065d6428a84a119dd8a3c90f1397 /completions/export
parentAdding upstream version 1:2.11. (diff)
downloadbash-completion-f4acb49ea148cdd899f7f29f1591c7bc853c2135.tar.xz
bash-completion-f4acb49ea148cdd899f7f29f1591c7bc853c2135.zip
Adding upstream version 1:2.12.0.upstream/1%2.12.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'completions/export')
-rw-r--r--completions/export35
1 files changed, 17 insertions, 18 deletions
diff --git a/completions/export b/completions/export
index 8d82361..0f692c9 100644
--- a/completions/export
+++ b/completions/export
@@ -1,11 +1,11 @@
# bash export completion -*- shell-script -*-
-_export()
+_comp_cmd_export()
{
- local cur prev words cword
- _init_completion -n = || return
+ local cur prev words cword comp_args
+ _comp_initialize -n := -- "$@" || return
- local i action=variable remove=false
+ local i action=variable remove=""
for ((i = 1; i < cword; i++)); do
case ${words[i]} in
-p)
@@ -15,7 +15,7 @@ _export()
action=function
;;&
-*n*)
- remove=true
+ remove=set
;;
-*)
continue
@@ -25,41 +25,40 @@ _export()
done
if [[ $cur == *=* ]]; then
- local ocur=$cur oprev=$prev
- prev=${cur%%=*} cur=${cur#*=}
- _variables && return
- cur=$ocur prev=$oprev
+ _comp_variable_assignments "$cur" && return
fi
case $cur in
*=)
- local pval=$(quote "$(eval printf %s \"\$\{${cur%=}-\}\")")
+ local pname=${cur%=}
+ local REPLY
+ _comp_quote "${!pname-}"
+ local pval=$REPLY
# Complete previous value if it's not empty.
if [[ $pval != \'\' ]]; then
COMPREPLY=("$pval")
else
- cur=${cur#*=}
- _filedir
+ _comp_compgen -c "${cur#*=}" filedir
fi
;;
*=*)
- cur=${cur#*=}
- _filedir
+ _comp_compgen -c "${cur#*=}" filedir
;;
*)
if [[ $cword -eq 1 && $cur == -* ]]; then
- COMPREPLY=($(compgen -W '-p $(_parse_usage "$1")' -- "$cur"))
+ _comp_compgen_usage -c help -s "$1"
+ _comp_compgen -a -- -W '-p'
return
fi
local suffix=""
- if ! $remove; then
+ if [[ ! $remove && $action != function ]]; then
suffix="="
compopt -o nospace
fi
- COMPREPLY=($(compgen -A $action -S "$suffix" -- "$cur"))
+ _comp_compgen -- -A $action -S "$suffix"
;;
esac
} &&
- complete -F _export export
+ complete -F _comp_cmd_export export
# ex: filetype=sh