diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-17 14:57:17 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-17 14:57:17 +0000 |
commit | 8c80e4dce14eed4e3c06b16fc307c6c7d20b9af8 (patch) | |
tree | 4477eaed15415ddadc3e88205234659628759415 /completions/env | |
parent | Releasing progress-linux version 1:2.13.0-1~progress7.99u1. (diff) | |
download | bash-completion-8c80e4dce14eed4e3c06b16fc307c6c7d20b9af8.tar.xz bash-completion-8c80e4dce14eed4e3c06b16fc307c6c7d20b9af8.zip |
Merging upstream version 1:2.14.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'completions/env')
-rw-r--r-- | completions/env | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/completions/env b/completions/env new file mode 100644 index 0000000..9576510 --- /dev/null +++ b/completions/env @@ -0,0 +1,56 @@ +# bash completion for env(1) -*- shell-script -*- + +_comp_cmd_env() +{ + local cur prev words cword was_split comp_args + _comp_initialize -s -- "$@" || return + + local i noargopts='!(-*|*[uCS]*)' + for ((i = 1; i <= cword; i++)); do + if [[ ${words[i]} != -* || ${words[i]} == -?(-) && i -lt cword ]]; then + [[ ${words[i]} == -?(-) ]] && ((i++)) + for (( ; i <= cword; i++)); do + if [[ ${words[i]} != *=* ]]; then + _comp_command_offset "$i" + return + fi + done + break + fi + + # shellcheck disable=SC2254 + [[ ${words[i]} == @(--@(unset|chdir|split-string)|-${noargopts}[uCS]) ]] && + ((i++)) + done + + # shellcheck disable=SC2254 + case "$prev" in + --unset | -${noargopts}u) + _comp_compgen -- -A variable + return + ;; + --chdir | -${noargopts}C) + _comp_compgen_filedir -d + return + ;; + --split-string | -${noargopts}S) + return + ;; + --block-signal | --default-signal | --ignore-signal) + # TODO signals, but only if completing with a =SIG + ;; + esac + + [[ $was_split ]] && return + + _comp_variable_assignments "$cur" && return + + if [[ $cur == -* ]]; then + _comp_compgen_help || _comp_compgen_usage + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi +} && + complete -F _comp_cmd_env env + +# ex: filetype=sh |