@@ -98,8 +98,6 @@ _comp_userland()
9898 [[ $userland == " $1 " ]]
9999}
100100
101- _comp_deprecate_func _userland _comp_userland
102-
103101# This function sets correct SysV init directories
104102#
105103_comp_sysvdirs ()
@@ -112,8 +110,6 @@ _comp_sysvdirs()
112110 return 0
113111}
114112
115- _comp_deprecate_func _sysvdirs _comp_sysvdirs
116-
117113# This function checks whether we have a given program on the system.
118114#
119115_comp_have_command ()
@@ -123,18 +119,6 @@ _comp_have_command()
123119 PATH=$PATH :/usr/sbin:/sbin:/usr/local/sbin type " $1 " & > /dev/null
124120}
125121
126- _comp_deprecate_func _have _comp_have_command
127-
128- # Backwards compatibility for compat completions that use have().
129- # @deprecated should no longer be used; generally not needed with dynamically
130- # loaded completions, and _comp_have_command is suitable for runtime use.
131- # shellcheck disable=SC2317 # available at load time only
132- have ()
133- {
134- unset -v have
135- _comp_have_command " $1 " && have=yes
136- }
137-
138122# This function checks whether a given readline variable
139123# is `on'.
140124#
@@ -143,8 +127,6 @@ _comp_readline_variable_on()
143127 [[ $( bind -v) == * $1 + ([[:space:]])on* ]]
144128}
145129
146- _comp_deprecate_func _rl_enabled _comp_readline_variable_on
147-
148130# This function shell-quotes the argument
149131# @param $1 String to be quoted
150132# @var[out] ret Resulting string
@@ -153,15 +135,6 @@ _comp_quote()
153135 ret=\' ${1// \' / \'\\\'\' } \'
154136}
155137
156- # This function shell-quotes the argument
157- # @deprecated Use `_comp_quote` instead. Note that `_comp_quote` stores
158- # the results in the variable `ret` instead of writing them to stdout.
159- quote ()
160- {
161- local quoted=${1// \' / \'\\\'\' }
162- printf " '%s'" " $quoted "
163- }
164-
165138# @see _quote_readline_by_ref()
166139quote_readline ()
167140{
@@ -231,18 +204,6 @@ _comp_dequote()
231204 eval " ret=($1 )" 2> /dev/null # may produce failglob
232205}
233206
234- # This function shell-dequotes the argument
235- # @deprecated Use `_comp_dequote' instead. Note that `_comp_dequote` stores
236- # the results in the array `ret` instead of writing them to stdout.
237- dequote ()
238- {
239- local ret
240- _comp_dequote " $1 "
241- local rc=$?
242- printf %s " $ret "
243- return $rc
244- }
245-
246207# Unset the given variables across a scope boundary. Useful for unshadowing
247208# global scoped variables. Note that simply calling unset on a local variable
248209# will not unshadow the global variable. Rather, the result will be a local
@@ -260,29 +221,6 @@ _comp_unlocal()
260221 fi
261222}
262223
263- # Assign variable one scope above the caller
264- # Usage: local "$1" && _upvar $1 "value(s)"
265- # @param $1 Variable name to assign value to
266- # @param $* Value(s) to assign. If multiple values, an array is
267- # assigned, otherwise a single value is assigned.
268- # NOTE: For assigning multiple variables, use '_upvars'. Do NOT
269- # use multiple '_upvar' calls, since one '_upvar' call might
270- # reassign a variable to be used by another '_upvar' call.
271- # @see https://fvue.nl/wiki/Bash:_Passing_variables_by_reference
272- _upvar ()
273- {
274- echo " bash_completion: $FUNCNAME : deprecated function," \
275- " use _upvars instead" >&2
276- if unset -v " $1 " ; then # Unset & validate varname
277- # shellcheck disable=SC2140 # TODO
278- if (( $# == 2 )) ; then
279- eval " $1 " =\"\$ 2\" # Return single value
280- else
281- eval " $1 " =\(\"\$ " {@:2}" \"\) # Return array
282- fi
283- fi
284- }
285-
286224# Assign variables one scope above the caller
287225# Usage: local varname [varname ...] &&
288226# _upvars [-v varname value] | [-aN varname [value ...]] ...
@@ -648,66 +586,6 @@ _get_comp_words_by_ref()
648586 (( ${# upvars[@]} )) && local " ${upvars[@]} " && _upvars " ${upargs[@]} "
649587}
650588
651- # Get the word to complete.
652- # This is nicer than ${COMP_WORDS[COMP_CWORD]}, since it handles cases
653- # where the user is completing in the middle of a word.
654- # (For example, if the line is "ls foobar",
655- # and the cursor is here --------> ^
656- # @param $1 string Characters out of $COMP_WORDBREAKS which should NOT be
657- # considered word breaks. This is useful for things like scp where
658- # we want to return host:path and not only path, so we would pass the
659- # colon (:) as $1 in this case.
660- # @param $2 integer Index number of word to return, negatively offset to the
661- # current word (default is 0, previous is 1), respecting the exclusions
662- # given at $1. For example, `_get_cword "=:" 1' returns the word left of
663- # the current word, respecting the exclusions "=:".
664- # @deprecated Use `_get_comp_words_by_ref cur' instead
665- # @see _get_comp_words_by_ref()
666- _get_cword ()
667- {
668- local LC_CTYPE=C
669- local cword words
670- __reassemble_comp_words_by_ref " ${1-} " words cword
671-
672- # return previous word offset by $2
673- if [[ ${2-} && ${2// [^0-9]/ } ]]; then
674- printf " %s" " ${words[cword - $2]} "
675- elif (( ${# words[cword]} == 0 && COMP_POINT == ${# COMP_LINE} )) ; then
676- : # nothing
677- else
678- local i
679- local cur=$COMP_LINE
680- local index=$COMP_POINT
681- for (( i = 0 ; i <= cword; ++ i)) ; do
682- # Current word fits in $cur, and $cur doesn't match cword?
683- while [[ ${# cur} -ge ${# words[i]} &&
684- ${cur: 0: ${# words[i]} } != " ${words[i]} " ]]; do
685- # Strip first character
686- cur=${cur: 1}
687- # Decrease cursor position, staying >= 0
688- (( index > 0 )) && (( index-- ))
689- done
690-
691- # Does found word match cword?
692- if (( i < cword)) ; then
693- # No, cword lies further;
694- local old_size=${# cur}
695- cur=${cur# " ${words[i]} " }
696- local new_size=${# cur}
697- (( index -= old_size - new_size))
698- fi
699- done
700-
701- if [[ ${words[cword]: 0: ${# cur} } != " $cur " ]]; then
702- # We messed up! At least return the whole word so things
703- # keep working
704- printf " %s" " ${words[cword]} "
705- else
706- printf " %s" " ${cur: 0: index} "
707- fi
708- fi
709- } # _get_cword()
710-
711589# Get word previous to the current word.
712590# This is a good alternative to `prev=${COMP_WORDS[COMP_CWORD-1]}' because bash4
713591# will properly return the previous word with respect to any given exclusions to
@@ -1127,7 +1005,6 @@ _comp_initialize()
11271005
11281006 return 0
11291007}
1130- _comp_deprecate_func _init_completion _comp_initialize
11311008
11321009# Helper function for _parse_help and _parse_usage.
11331010# @return True (0) if an option was found, False (> 0) otherwise
@@ -1582,10 +1459,6 @@ _gids()
15821459#
15831460_comp_backup_glob= ' @(#*#|*@(~|.@(bak|orig|rej|swp|dpkg*|rpm@(orig|new|save))))'
15841461
1585- # @deprecated Use the variable `_comp_backup_glob` instead. This is the
1586- # backward-compatibility name.
1587- _backup_glob= $_comp_backup_glob
1588-
15891462# Complete on xinetd services
15901463#
15911464_xinetd_services ()
@@ -2387,7 +2260,6 @@ _comp_command_offset()
23872260 done
23882261 fi
23892262}
2390- _comp_deprecate_func _command_offset _comp_command_offset
23912263
23922264# A _comp_command_offset wrapper function for use when the offset is unknown.
23932265# Only intended to be used as a completion function directly associated
@@ -2407,7 +2279,6 @@ _comp_command()
24072279 done
24082280 _comp_command_offset $offset
24092281}
2410- _comp_deprecate_func _command _comp_command
24112282complete -F _comp_command aoss command " do" else eval exec ltrace nice nohup padsp \
24122283 " then" time tsocks vsound xargs
24132284
@@ -2417,7 +2288,6 @@ _comp_root_command()
24172288 local root_command=$1
24182289 _comp_command
24192290}
2420- _comp_deprecate_func _root_command _comp_root_command
24212291complete -F _comp_root_command fakeroot gksu gksudo kdesudo really
24222292
24232293# Return true if the completion should be treated as running as root
@@ -2739,8 +2609,6 @@ _comp_xfunc()
27392609 " $xfunc_name " " ${@: 3} "
27402610}
27412611
2742- _comp_deprecate_func _xfunc _comp_xfunc
2743-
27442612# source compat completion directory definitions
27452613_comp__init_compat_dir=${BASH_COMPLETION_COMPAT_DIR:-/ etc/ bash_completion.d}
27462614if [[ -d $_comp__init_compat_dir && -r $_comp__init_compat_dir && -x $_comp__init_compat_dir ]]; then
0 commit comments