Skip to content

Commit a024256

Browse files
committed
docs(compat): add @since and @deprecated versions
1 parent 9b70abe commit a024256

File tree

3 files changed

+89
-25
lines changed

3 files changed

+89
-25
lines changed

bash_completion

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ shopt -s extglob progcomp
4444
# @param $1 Version of bash-completion where the deprecation occurred
4545
# @param $2 Old function name
4646
# @param $3 New function name
47+
# @since 2.12
4748
_comp_deprecate_func()
4849
{
4950
if (($# != 3)); then
@@ -96,6 +97,7 @@ complete -b builtin
9697

9798
# Check if we're running on the given userland
9899
# @param $1 userland to check for
100+
# @since 2.12
99101
_comp_userland()
100102
{
101103
local userland=$(uname -s)
@@ -105,6 +107,7 @@ _comp_userland()
105107

106108
# This function sets correct SysV init directories
107109
#
110+
# @since 2.12
108111
_comp_sysvdirs()
109112
{
110113
sysvdirs=()
@@ -117,6 +120,7 @@ _comp_sysvdirs()
117120

118121
# This function checks whether we have a given program on the system.
119122
#
123+
# @since 2.12
120124
_comp_have_command()
121125
{
122126
# Completions for system administrator commands are installed as well in
@@ -127,6 +131,7 @@ _comp_have_command()
127131
# This function checks whether a given readline variable
128132
# is `on'.
129133
#
134+
# @since 2.12
130135
_comp_readline_variable_on()
131136
{
132137
[[ $(bind -v) == *$1+([[:space:]])on* ]]
@@ -135,6 +140,7 @@ _comp_readline_variable_on()
135140
# This function shell-quotes the argument
136141
# @param $1 String to be quoted
137142
# @var[out] ret Resulting string
143+
# @since 2.12
138144
_comp_quote()
139145
{
140146
ret=\'${1//\'/\'\\\'\'}\'
@@ -194,6 +200,7 @@ _comp_dequote__initialize
194200
# We allow these parameter expansions as a part of safe strings assuming the
195201
# referential transparency of the simple parameter expansions and the sane
196202
# setup of the variables by the user or other frameworks that the user loads.
203+
# @since 2.12
197204
_comp_dequote()
198205
{
199206
ret=() # fallback value for unsafe word and failglob
@@ -207,6 +214,7 @@ _comp_dequote()
207214
# variable in an unset state.
208215
# Usage: local IFS='|'; _comp_unlocal IFS
209216
# @param $* Variable names to be unset
217+
# @since 2.12
210218
_comp_unlocal()
211219
{
212220
if ((BASH_VERSINFO[0] >= 5)) && shopt -q localvar_unset; then
@@ -226,6 +234,7 @@ _comp_unlocal()
226234
# -v Assign single value to varname
227235
# @return 1 if error occurs
228236
# @see https://fvue.nl/wiki/Bash:_Passing_variables_by_reference
237+
# @since 2.12
229238
_comp_upvars()
230239
{
231240
if ! (($#)); then
@@ -286,6 +295,7 @@ _comp_upvars()
286295
# parameter expansions, command substitutions, and other expansions will be
287296
# processed. The user-provided strings should not be directly specified to
288297
# this argument.
298+
# @since 2.12
289299
_comp_expand_glob()
290300
{
291301
if (($# != 2)); then
@@ -342,6 +352,7 @@ _comp_expand_glob()
342352
# @return 2 when the usage is wrong, 0 when one or more completions are
343353
# generated, or 1 when the execution succeeds but no candidates are
344354
# generated.
355+
# @since 2.12
345356
_comp_split()
346357
{
347358
local _append="" IFS=$' \t\n'
@@ -467,6 +478,7 @@ _comp_split()
467478
# supposed to replace the existing content of the array by default to allow the
468479
# caller control whether to replace or append by the option `-a`.
469480
#
481+
# @since 2.12
470482
_comp_compgen()
471483
{
472484
local _append=${_comp_compgen__append-}
@@ -562,6 +574,7 @@ _comp_compgen()
562574
# caller _comp_compgen, the words are appended to the existing elements of the
563575
# array instead of replacing the existing elements. This function ignores
564576
# ${cur-} or the prefix specified by `-v CUR`.
577+
# @since 2.12
565578
_comp_compgen_set()
566579
{
567580
local _append=${_comp_compgen__append-}
@@ -572,6 +585,7 @@ _comp_compgen_set()
572585
# Check if the argument looks like a path.
573586
# @param $1 thing to check
574587
# @return True (0) if it does, False (> 0) otherwise
588+
# @since 2.12
575589
_comp_looks_like_path()
576590
{
577591
[[ ${1-} == @(*/|[.~])* ]]
@@ -722,6 +736,7 @@ _comp__get_cword_at_cursor()
722736
#
723737
# $ _comp_get_words -n : cur prev
724738
#
739+
# @since 2.12
725740
_comp_get_words()
726741
{
727742
local exclude="" flag i OPTIND=1
@@ -801,6 +816,7 @@ _comp_get_words()
801816
# @param $1 current word to complete (cur)
802817
# @modifies global array $COMPREPLY
803818
#
819+
# @since 2.12
804820
_comp_ltrim_colon_completions()
805821
{
806822
local i=${#COMPREPLY[*]}
@@ -830,6 +846,7 @@ _comp_ltrim_colon_completions()
830846
# - https://www.mail-archive.com/bash-completion-devel@lists.alioth.debian.org/msg01944.html
831847
# @param $1 Argument to quote
832848
# @var[out] ret Quoted result is stored in this variable
849+
# @since 2.12
833850
# shellcheck disable=SC2178 # The assignment is not intended for the global "ret"
834851
_comp_quote_compgen()
835852
{
@@ -857,6 +874,7 @@ _comp_quote_compgen()
857874
# completions with `.$1' and the uppercase version of it as file
858875
# extension.
859876
#
877+
# @since 2.12
860878
_comp_compgen_filedir()
861879
{
862880
_comp_compgen_tilde && return
@@ -977,6 +995,7 @@ _variables()
977995
#
978996
# Usage: [-k] DELIMITER COMPGEN_ARG...
979997
# -k: do not filter out already present tokens in value
998+
# @since 2.12
980999
_comp_delimited()
9811000
{
9821001
local prefix="" delimiter=$1 deduplicate=set
@@ -1040,6 +1059,7 @@ _comp_delimited()
10401059
# @param $1 variable assignment to be completed
10411060
# @return True (0) if variable value completion was attempted,
10421061
# False (> 0) if not.
1062+
# @since 2.12
10431063
_comp_variable_assignments()
10441064
{
10451065
local cur=${1-} i
@@ -1118,6 +1138,7 @@ _comp_variable_assignments()
11181138
# @return True (0) if completion needs further processing,
11191139
# False (> 0) no further processing is necessary.
11201140
#
1141+
# @since 2.12
11211142
_comp_initialize()
11221143
{
11231144
local exclude="" opt_split="" outx errx inx
@@ -1285,6 +1306,7 @@ _comp_compgen_help__parse()
12851306
# When no arguments are specified, `--help` is assumed.
12861307
#
12871308
# @var[in] comp_args[0]
1309+
# @since 2.12
12881310
_comp_compgen_help()
12891311
{
12901312
(($#)) || set -- -- --help
@@ -1316,6 +1338,7 @@ _comp_compgen_help()
13161338
# When no arguments are specified, `--usage` is assumed.
13171339
#
13181340
# @var[in] comp_args[0]
1341+
# @since 2.12
13191342
_comp_compgen_usage()
13201343
{
13211344
(($#)) || set -- -- --usage
@@ -1498,6 +1521,7 @@ _ncpus()
14981521
# @return False (1) if completion needs further processing,
14991522
# True (0) if tilde is followed by a valid username, completions are
15001523
# put in COMPREPLY and no further processing is necessary.
1524+
# @since 2.12
15011525
_comp_compgen_tilde()
15021526
{
15031527
if [[ ${cur-} == \~* && $cur != */* ]]; then
@@ -1853,6 +1877,7 @@ _allowed_groups()
18531877
fi
18541878
}
18551879

1880+
# @since 2.12
18561881
_comp_selinux_users()
18571882
{
18581883
_comp_compgen -a -- -W '$(
@@ -1901,6 +1926,7 @@ _fstypes()
19011926
# see `_comp_realcommand` for those.
19021927
# @param $1 The file
19031928
# @var[out] ret The path
1929+
# @since 2.12
19041930
_comp_abspath()
19051931
{
19061932
ret=$1
@@ -1921,6 +1947,7 @@ _comp_abspath()
19211947
# @param $1 Command
19221948
# @var[out] ret Resulting string
19231949
# @return True (0) if command found, False (> 0) if not.
1950+
# @since 2.12
19241951
_comp_realcommand()
19251952
{
19261953
ret=""
@@ -2372,6 +2399,7 @@ _comp__find_original_word()
23722399
# first complete on a command, then complete according to that command's own
23732400
# completion definition.
23742401
#
2402+
# @since 2.12
23752403
_comp_command_offset()
23762404
{
23772405
# rewrite current completion context before invoking
@@ -2489,6 +2517,7 @@ _comp_command_offset()
24892517
# Only intended to be used as a completion function directly associated
24902518
# with a command, not to be invoked from within other completion functions.
24912519
#
2520+
# @since 2.12
24922521
_comp_command()
24932522
{
24942523
# We unset the shell variable `words` locally to tell
@@ -2512,6 +2541,7 @@ _comp_command()
25122541
complete -F _comp_command aoss command "do" else eval exec ltrace nice nohup padsp \
25132542
"then" time tsocks vsound xargs
25142543

2544+
# @since 2.12
25152545
_comp_root_command()
25162546
{
25172547
local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
@@ -2527,6 +2557,7 @@ _complete_as_root()
25272557
[[ $EUID -eq 0 || ${root_command-} ]]
25282558
}
25292559

2560+
# @since 2.12
25302561
_comp_longopt()
25312562
{
25322563
local cur prev words cword was_split comp_args
@@ -2846,6 +2877,7 @@ _completion_loader()
28462877
# `_comp_xfunc_${1//[^a-zA-Z0-9_]/_}_$2' is used for the actual name of the
28472878
# shell function.
28482879
# @param $3... if any, specifies the arguments that are passed to the xfunc.
2880+
# @since 2.12
28492881
_comp_xfunc()
28502882
{
28512883
local xfunc_name=$2

0 commit comments

Comments
 (0)