From 8c80e4dce14eed4e3c06b16fc307c6c7d20b9af8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 17 May 2024 16:57:17 +0200 Subject: Merging upstream version 1:2.14.0. Signed-off-by: Daniel Baumann --- bash_completion | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'bash_completion') diff --git a/bash_completion b/bash_completion index 42a5dca..2bc27cc 100644 --- a/bash_completion +++ b/bash_completion @@ -25,7 +25,7 @@ BASH_COMPLETION_VERSINFO=( 2 # x-release-please-major - 13 # x-release-please-minor + 14 # x-release-please-minor 0 # x-release-please-patch ) @@ -649,7 +649,7 @@ _comp_compgen() else _generator=("_comp_compgen_$1") fi - if ! declare -F "${_generator[0]}" &>/dev/null; then + if ! declare -F -- "${_generator[0]}" &>/dev/null; then printf 'bash_completion: %s: unrecognized generator `%s'\'' (function %s not found)\n' "$FUNCNAME" "$1" "${_generator[0]}" >&2 return 2 fi @@ -1737,7 +1737,7 @@ _comp_compgen_available_interfaces() fi } 2>/dev/null | _comp_awk \ '/^[^ \t]/ { if ($1 ~ /^[0-9]+:/) { print $2 } else { print $1 } }')" && - _comp_compgen -U generated set "${generated[@]%%[[:punct:]]*}" + _comp_compgen -U generated set "${generated[@]%:}" } # Echo number of CPUs, falling back to 1 on failure. @@ -2201,7 +2201,7 @@ _comp_realcommand() { REPLY="" local file - file=$(type -P "$1") || return $? + file=$(type -P -- "$1") || return $? if type -p realpath >/dev/null; then REPLY=$(realpath "$file") elif type -p greadlink >/dev/null; then @@ -2765,18 +2765,18 @@ _comp_command_offset() else _comp_dequote "${COMP_WORDS[0]}" || REPLY=${COMP_WORDS[0]} local cmd=$REPLY compcmd=$REPLY - local cspec=$(complete -p "$cmd" 2>/dev/null) + local cspec=$(complete -p -- "$cmd" 2>/dev/null) # If we have no completion for $cmd yet, see if we have for basename if [[ ! $cspec && $cmd == */* ]]; then - cspec=$(complete -p "${cmd##*/}" 2>/dev/null) + cspec=$(complete -p -- "${cmd##*/}" 2>/dev/null) [[ $cspec ]] && compcmd=${cmd##*/} fi # If still nothing, just load it for the basename if [[ ! $cspec ]]; then compcmd=${cmd##*/} _comp_load -D -- "$compcmd" - cspec=$(complete -p "$compcmd" 2>/dev/null) + cspec=$(complete -p -- "$compcmd" 2>/dev/null) fi local retry_count=0 @@ -2809,7 +2809,7 @@ _comp_command_offset() # state of COMPREPLY is discarded. COMPREPLY=() - cspec=$(complete -p "$compcmd" 2>/dev/null) + cspec=$(complete -p -- "$compcmd" 2>/dev/null) # Note: When completion spec is removed after 124, we # do not generate any completions including the default @@ -2991,7 +2991,7 @@ _comp_complete_longopt() # makeinfo and texi2dvi are defined elsewhere. complete -F _comp_complete_longopt \ a2ps awk base64 bash bc bison cat chroot colordiff cp \ - csplit cut date df diff dir du enscript env expand fmt fold gperf \ + csplit cut date df diff dir du enscript expand fmt fold gperf \ grep grub head irb ld ldd less ln ls m4 mkdir mkfifo mknod \ mv netstat nl nm objcopy objdump od paste pr ptx readelf rm rmdir \ sed seq shar sort split strip sum tac tail tee \ @@ -3147,13 +3147,13 @@ _comp_load() if [[ $cmd == \\* ]]; then cmd=${cmd:1} # If we already have a completion for the "real" command, use it - $(complete -p "$cmd" 2>/dev/null || echo false) "\\$cmd" && return 0 + $(complete -p -- "$cmd" 2>/dev/null || echo false) "\\$cmd" && return 0 backslash=\\ fi # Resolve absolute path to $cmd local REPLY pathcmd origcmd=$cmd - if pathcmd=$(type -P "$cmd"); then + if pathcmd=$(type -P -- "$cmd"); then _comp_abspath "$pathcmd" cmd=$REPLY fi @@ -3222,18 +3222,18 @@ _comp_load() elif [[ -e $compfile ]] && . "$compfile" "$cmd" "$@"; then # At least $cmd is expected to have a completion set when # we return successfully; see if it already does - if compspec=$(complete -p "$cmd" 2>/dev/null); then + if compspec=$(complete -p -- "$cmd" 2>/dev/null); then # $cmd is the case in which we do backslash processing [[ $backslash ]] && eval "$compspec \"\$backslash\$cmd\"" # If invoked without path, that one should be set, too # ...but let's not overwrite an existing one, if any [[ $origcmd != */* ]] && - ! complete -p "$origcmd" &>/dev/null && + ! complete -p -- "$origcmd" &>/dev/null && eval "$compspec \"\$origcmd\"" return 0 fi # If not, see if we got one for $cmdname - if [[ $cmdname != "$cmd" ]] && compspec=$(complete -p "$cmdname" 2>/dev/null); then + if [[ $cmdname != "$cmd" ]] && compspec=$(complete -p -- "$cmdname" 2>/dev/null); then # Use that for $cmd too, if we have a full path to it [[ $cmd == /* ]] && eval "$compspec \"\$cmd\"" return 0 @@ -3281,7 +3281,7 @@ _comp_xfunc() local xfunc_name=$2 [[ $xfunc_name == _* ]] || xfunc_name=_comp_xfunc_${1//[^a-zA-Z0-9_]/_}_$xfunc_name - declare -F "$xfunc_name" &>/dev/null || _comp_load "$1" + declare -F -- "$xfunc_name" &>/dev/null || _comp_load -- "$1" "$xfunc_name" "${@:3}" } -- cgit v1.2.3