@@ -44,6 +44,7 @@ shopt -s extglob progcomp
44
44
# @param $1 Version of bash-completion where the deprecation occurred
45
45
# @param $2 Old function name
46
46
# @param $3 New function name
47
+ # @since 2.12
47
48
_comp_deprecate_func ()
48
49
{
49
50
if (( $# != 3 )) ; then
@@ -96,6 +97,7 @@ complete -b builtin
96
97
97
98
# Check if we're running on the given userland
98
99
# @param $1 userland to check for
100
+ # @since 2.12
99
101
_comp_userland ()
100
102
{
101
103
local userland=$( uname -s)
@@ -105,6 +107,7 @@ _comp_userland()
105
107
106
108
# This function sets correct SysV init directories
107
109
#
110
+ # @since 2.12
108
111
_comp_sysvdirs ()
109
112
{
110
113
sysvdirs=()
@@ -117,6 +120,7 @@ _comp_sysvdirs()
117
120
118
121
# This function checks whether we have a given program on the system.
119
122
#
123
+ # @since 2.12
120
124
_comp_have_command ()
121
125
{
122
126
# Completions for system administrator commands are installed as well in
@@ -127,6 +131,7 @@ _comp_have_command()
127
131
# This function checks whether a given readline variable
128
132
# is `on'.
129
133
#
134
+ # @since 2.12
130
135
_comp_readline_variable_on ()
131
136
{
132
137
[[ $( bind -v) == * $1 + ([[:space:]])on* ]]
@@ -135,6 +140,7 @@ _comp_readline_variable_on()
135
140
# This function shell-quotes the argument
136
141
# @param $1 String to be quoted
137
142
# @var[out] ret Resulting string
143
+ # @since 2.12
138
144
_comp_quote ()
139
145
{
140
146
ret=\' ${1// \' / \'\\\'\' } \'
@@ -194,6 +200,7 @@ _comp_dequote__initialize
194
200
# We allow these parameter expansions as a part of safe strings assuming the
195
201
# referential transparency of the simple parameter expansions and the sane
196
202
# setup of the variables by the user or other frameworks that the user loads.
203
+ # @since 2.12
197
204
_comp_dequote ()
198
205
{
199
206
ret=() # fallback value for unsafe word and failglob
@@ -207,6 +214,7 @@ _comp_dequote()
207
214
# variable in an unset state.
208
215
# Usage: local IFS='|'; _comp_unlocal IFS
209
216
# @param $* Variable names to be unset
217
+ # @since 2.12
210
218
_comp_unlocal ()
211
219
{
212
220
if (( BASH_VERSINFO[0 ] >= 5 )) && shopt -q localvar_unset; then
@@ -226,6 +234,7 @@ _comp_unlocal()
226
234
# -v Assign single value to varname
227
235
# @return 1 if error occurs
228
236
# @see https://fvue.nl/wiki/Bash:_Passing_variables_by_reference
237
+ # @since 2.12
229
238
_comp_upvars ()
230
239
{
231
240
if ! (( $# )) ; then
@@ -286,6 +295,7 @@ _comp_upvars()
286
295
# parameter expansions, command substitutions, and other expansions will be
287
296
# processed. The user-provided strings should not be directly specified to
288
297
# this argument.
298
+ # @since 2.12
289
299
_comp_expand_glob ()
290
300
{
291
301
if (( $# != 2 )) ; then
@@ -342,6 +352,7 @@ _comp_expand_glob()
342
352
# @return 2 when the usage is wrong, 0 when one or more completions are
343
353
# generated, or 1 when the execution succeeds but no candidates are
344
354
# generated.
355
+ # @since 2.12
345
356
_comp_split ()
346
357
{
347
358
local _append=" " IFS=$' \t\n '
@@ -467,6 +478,7 @@ _comp_split()
467
478
# supposed to replace the existing content of the array by default to allow the
468
479
# caller control whether to replace or append by the option `-a`.
469
480
#
481
+ # @since 2.12
470
482
_comp_compgen ()
471
483
{
472
484
local _append=${_comp_compgen__append-}
@@ -562,6 +574,7 @@ _comp_compgen()
562
574
# caller _comp_compgen, the words are appended to the existing elements of the
563
575
# array instead of replacing the existing elements. This function ignores
564
576
# ${cur-} or the prefix specified by `-v CUR`.
577
+ # @since 2.12
565
578
_comp_compgen_set ()
566
579
{
567
580
local _append=${_comp_compgen__append-}
@@ -572,6 +585,7 @@ _comp_compgen_set()
572
585
# Check if the argument looks like a path.
573
586
# @param $1 thing to check
574
587
# @return True (0) if it does, False (> 0) otherwise
588
+ # @since 2.12
575
589
_comp_looks_like_path ()
576
590
{
577
591
[[ ${1-} == @ (* /| [.~])* ]]
@@ -722,6 +736,7 @@ _comp__get_cword_at_cursor()
722
736
#
723
737
# $ _comp_get_words -n : cur prev
724
738
#
739
+ # @since 2.12
725
740
_comp_get_words ()
726
741
{
727
742
local exclude=" " flag i OPTIND=1
@@ -801,6 +816,7 @@ _comp_get_words()
801
816
# @param $1 current word to complete (cur)
802
817
# @modifies global array $COMPREPLY
803
818
#
819
+ # @since 2.12
804
820
_comp_ltrim_colon_completions ()
805
821
{
806
822
local i=${# COMPREPLY[*]}
@@ -830,6 +846,7 @@ _comp_ltrim_colon_completions()
830
846
# - https://www.mail-archive.com/bash-completion-devel@lists.alioth.debian.org/msg01944.html
831
847
# @param $1 Argument to quote
832
848
# @var[out] ret Quoted result is stored in this variable
849
+ # @since 2.12
833
850
# shellcheck disable=SC2178 # The assignment is not intended for the global "ret"
834
851
_comp_quote_compgen ()
835
852
{
@@ -857,6 +874,7 @@ _comp_quote_compgen()
857
874
# completions with `.$1' and the uppercase version of it as file
858
875
# extension.
859
876
#
877
+ # @since 2.12
860
878
_comp_compgen_filedir ()
861
879
{
862
880
_comp_compgen_tilde && return
@@ -977,6 +995,7 @@ _variables()
977
995
#
978
996
# Usage: [-k] DELIMITER COMPGEN_ARG...
979
997
# -k: do not filter out already present tokens in value
998
+ # @since 2.12
980
999
_comp_delimited ()
981
1000
{
982
1001
local prefix=" " delimiter=$1 deduplicate=set
@@ -1040,6 +1059,7 @@ _comp_delimited()
1040
1059
# @param $1 variable assignment to be completed
1041
1060
# @return True (0) if variable value completion was attempted,
1042
1061
# False (> 0) if not.
1062
+ # @since 2.12
1043
1063
_comp_variable_assignments ()
1044
1064
{
1045
1065
local cur=${1-} i
@@ -1118,6 +1138,7 @@ _comp_variable_assignments()
1118
1138
# @return True (0) if completion needs further processing,
1119
1139
# False (> 0) no further processing is necessary.
1120
1140
#
1141
+ # @since 2.12
1121
1142
_comp_initialize ()
1122
1143
{
1123
1144
local exclude=" " opt_split=" " outx errx inx
@@ -1285,6 +1306,7 @@ _comp_compgen_help__parse()
1285
1306
# When no arguments are specified, `--help` is assumed.
1286
1307
#
1287
1308
# @var[in] comp_args[0 ]
1309
+ # @since 2 .12
1288
1310
_comp_compgen_help()
1289
1311
{
1290
1312
(($# )) || set -- -- --help
@@ -1316,6 +1338,7 @@ _comp_compgen_help()
1316
1338
# When no arguments are specified, `--usage` is assumed.
1317
1339
#
1318
1340
# @var[in] comp_args[0]
1341
+ # @since 2.12
1319
1342
_comp_compgen_usage ()
1320
1343
{
1321
1344
(( $# )) || set -- -- --usage
@@ -1498,6 +1521,7 @@ _ncpus()
1498
1521
# @return False (1) if completion needs further processing,
1499
1522
# True (0) if tilde is followed by a valid username, completions are
1500
1523
# put in COMPREPLY and no further processing is necessary.
1524
+ # @since 2.12
1501
1525
_comp_compgen_tilde ()
1502
1526
{
1503
1527
if [[ ${cur-} == \~ * && $cur != * /* ]]; then
@@ -1853,6 +1877,7 @@ _allowed_groups()
1853
1877
fi
1854
1878
}
1855
1879
1880
+ # @since 2.12
1856
1881
_comp_selinux_users ()
1857
1882
{
1858
1883
_comp_compgen -a -- -W ' $(
@@ -1901,6 +1926,7 @@ _fstypes()
1901
1926
# see `_comp_realcommand` for those.
1902
1927
# @param $1 The file
1903
1928
# @var[out] ret The path
1929
+ # @since 2.12
1904
1930
_comp_abspath ()
1905
1931
{
1906
1932
ret=$1
@@ -1921,6 +1947,7 @@ _comp_abspath()
1921
1947
# @param $1 Command
1922
1948
# @var[out] ret Resulting string
1923
1949
# @return True (0) if command found, False (> 0) if not.
1950
+ # @since 2.12
1924
1951
_comp_realcommand ()
1925
1952
{
1926
1953
ret=" "
@@ -2372,6 +2399,7 @@ _comp__find_original_word()
2372
2399
# first complete on a command, then complete according to that command's own
2373
2400
# completion definition.
2374
2401
#
2402
+ # @since 2.12
2375
2403
_comp_command_offset ()
2376
2404
{
2377
2405
# rewrite current completion context before invoking
@@ -2489,6 +2517,7 @@ _comp_command_offset()
2489
2517
# Only intended to be used as a completion function directly associated
2490
2518
# with a command, not to be invoked from within other completion functions.
2491
2519
#
2520
+ # @since 2.12
2492
2521
_comp_command ()
2493
2522
{
2494
2523
# We unset the shell variable `words` locally to tell
@@ -2512,6 +2541,7 @@ _comp_command()
2512
2541
complete -F _comp_command aoss command " do" else eval exec ltrace nice nohup padsp \
2513
2542
" then" time tsocks vsound xargs
2514
2543
2544
+ # @since 2.12
2515
2545
_comp_root_command ()
2516
2546
{
2517
2547
local PATH=$PATH :/sbin:/usr/sbin:/usr/local/sbin
@@ -2527,6 +2557,7 @@ _complete_as_root()
2527
2557
[[ $EUID -eq 0 || ${root_command-} ]]
2528
2558
}
2529
2559
2560
+ # @since 2.12
2530
2561
_comp_longopt ()
2531
2562
{
2532
2563
local cur prev words cword was_split comp_args
@@ -2846,6 +2877,7 @@ _completion_loader()
2846
2877
# `_comp_xfunc_${1//[^a-zA-Z0-9_]/_}_$2' is used for the actual name of the
2847
2878
# shell function.
2848
2879
# @param $3... if any, specifies the arguments that are passed to the xfunc.
2880
+ # @since 2.12
2849
2881
_comp_xfunc ()
2850
2882
{
2851
2883
local xfunc_name=$2
0 commit comments