@@ -223,13 +223,13 @@ _comp_unlocal()
223
223
224
224
# Assign variables one scope above the caller
225
225
# Usage: local varname [varname ...] &&
226
- # _upvars [-v varname value] | [-aN varname [value ...]] ...
226
+ # _comp_upvars [-v varname value] | [-aN varname [value ...]] ...
227
227
# Available OPTIONS:
228
228
# -aN Assign next N values to varname as array
229
229
# -v Assign single value to varname
230
230
# @return 1 if error occurs
231
231
# @see https://fvue.nl/wiki/Bash:_Passing_variables_by_reference
232
- _upvars ()
232
+ _comp_upvars ()
233
233
{
234
234
if ! (( $# )) ; then
235
235
echo " bash_completion: $FUNCNAME : usage: $FUNCNAME " \
@@ -394,7 +394,7 @@ _comp_looks_like_path()
394
394
# @param $2 words Name of variable to return words to
395
395
# @param $3 cword Name of variable to return cword to
396
396
#
397
- __reassemble_comp_words_by_ref ()
397
+ _comp__reassemble_comp_words_by_ref ()
398
398
{
399
399
local exclude i j line ref
400
400
# Exclude word separator characters?
@@ -454,7 +454,7 @@ __reassemble_comp_words_by_ref()
454
454
printf -v " $2 [i]" %s " ${COMP_WORDS[i]} "
455
455
done
456
456
fi
457
- } # __reassemble_comp_words_by_ref ()
457
+ } # _comp__reassemble_comp_words_by_ref ()
458
458
459
459
# @param $1 exclude Characters out of $COMP_WORDBREAKS which should NOT be
460
460
# considered word breaks. This is useful for things like scp where
@@ -463,11 +463,11 @@ __reassemble_comp_words_by_ref()
463
463
# @param $2 words Name of variable to return words to
464
464
# @param $3 cword Name of variable to return cword to
465
465
# @param $4 cur Name of variable to return current word to complete to
466
- # @see __reassemble_comp_words_by_ref ()
467
- __get_cword_at_cursor_by_ref ()
466
+ # @see _comp__reassemble_comp_words_by_ref ()
467
+ _comp__get_cword_at_cursor_by_ref ()
468
468
{
469
469
local cword words=()
470
- __reassemble_comp_words_by_ref " $1 " words cword
470
+ _comp__reassemble_comp_words_by_ref " $1 " words cword
471
471
472
472
local i cur=" " index=$COMP_POINT lead=${COMP_LINE: 0: COMP_POINT}
473
473
# Cursor not at position 0 and not led by just space(s)?
@@ -498,7 +498,7 @@ __get_cword_at_cursor_by_ref()
498
498
(( index < 0 )) && index=0
499
499
fi
500
500
501
- local " $2 " " $3 " " $4 " && _upvars -a${# words[@]} " $2 " ${words+" ${words[@]} " } \
501
+ local " $2 " " $3 " " $4 " && _comp_upvars -a${# words[@]} " $2 " ${words+" ${words[@]} " } \
502
502
-v " $3 " " $cword " -v " $4 " " ${cur: 0: index} "
503
503
}
504
504
@@ -508,7 +508,7 @@ __get_cword_at_cursor_by_ref()
508
508
# (For example, if the line is "ls foobar",
509
509
# and the cursor is here --------> ^
510
510
# Also one is able to cross over possible wordbreak characters.
511
- # Usage: _get_comp_words_by_ref [OPTIONS] [VARNAMES]
511
+ # Usage: _comp_get_comp_words_by_ref [OPTIONS] [VARNAMES]
512
512
# Available VARNAMES:
513
513
# cur Return cur via $cur
514
514
# prev Return prev via $prev
@@ -527,9 +527,9 @@ __get_cword_at_cursor_by_ref()
527
527
#
528
528
# Example usage:
529
529
#
530
- # $ _get_comp_words_by_ref -n : cur prev
530
+ # $ _comp_get_comp_words_by_ref -n : cur prev
531
531
#
532
- _get_comp_words_by_ref ()
532
+ _comp_get_comp_words_by_ref ()
533
533
{
534
534
local exclude flag i OPTIND=1
535
535
local cur cword words=()
@@ -564,7 +564,7 @@ _get_comp_words_by_ref()
564
564
(( OPTIND += 1 ))
565
565
done
566
566
567
- __get_cword_at_cursor_by_ref " ${exclude-} " words cword cur
567
+ _comp__get_cword_at_cursor_by_ref " ${exclude-} " words cword cur
568
568
569
569
[[ -v vcur ]] && {
570
570
upvars+=(" $vcur " )
@@ -583,15 +583,15 @@ _get_comp_words_by_ref()
583
583
upargs+=(-a${# words[@]} $vwords ${words+" ${words[@]} " } )
584
584
}
585
585
586
- (( ${# upvars[@]} )) && local " ${upvars[@]} " && _upvars " ${upargs[@]} "
586
+ (( ${# upvars[@]} )) && local " ${upvars[@]} " && _comp_upvars " ${upargs[@]} "
587
587
}
588
588
589
589
# Get word previous to the current word.
590
590
# This is a good alternative to `prev=${COMP_WORDS[COMP_CWORD-1]}' because bash4
591
591
# will properly return the previous word with respect to any given exclusions to
592
592
# COMP_WORDBREAKS.
593
- # @deprecated Use `_get_comp_words_by_ref cur prev' instead
594
- # @see _get_comp_words_by_ref ()
593
+ # @deprecated Use `_comp_get_comp_words_by_ref cur prev' instead
594
+ # @see _comp_get_comp_words_by_ref ()
595
595
#
596
596
_get_pword ()
597
597
{
@@ -662,7 +662,7 @@ _quote_readline_by_ref()
662
662
value=${value// ' %' /%% } # Escape % for printf format.
663
663
# shellcheck disable=SC2059
664
664
printf -v value " $value " # Decode escape sequences of \....
665
- local " $2 " && _upvars -v " $2 " " $value "
665
+ local " $2 " && _comp_upvars -v " $2 " " $value "
666
666
fi
667
667
fi
668
668
} # _quote_readline_by_ref()
@@ -909,7 +909,7 @@ _comp_variable_assignments()
909
909
# cur, prev, words, and cword are local, ditto split if you use -s.
910
910
#
911
911
# Options:
912
- # -n EXCLUDE Passed to _get_comp_words_by_ref -n with redirection chars
912
+ # -n EXCLUDE Passed to _comp_get_comp_words_by_ref -n with redirection chars
913
913
# -e XSPEC Passed to _filedir as first arg for stderr redirections
914
914
# -o XSPEC Passed to _filedir as first arg for other output redirections
915
915
# -i XSPEC Passed to _filedir as first arg for stdin redirections
@@ -957,7 +957,7 @@ _comp_initialize()
957
957
958
958
COMPREPLY=()
959
959
local redir=' @(?(+([0-9])|{[a-zA-Z_]*([a-zA-Z_0-9])})@(>?([>|&])|<?([>&])|<<?([-<]))|&>?(>))'
960
- _get_comp_words_by_ref -n " $exclude <>&" cur prev words cword
960
+ _comp_get_comp_words_by_ref -n " $exclude <>&" cur prev words cword
961
961
962
962
# Complete variable names.
963
963
_variables && return 1
@@ -1696,7 +1696,7 @@ _realcommand()
1696
1696
1697
1697
# This function returns the first argument, excluding options
1698
1698
# @param $1 chars Characters out of $COMP_WORDBREAKS which should
1699
- # NOT be considered word breaks. See __reassemble_comp_words_by_ref .
1699
+ # NOT be considered word breaks. See _comp__reassemble_comp_words_by_ref .
1700
1700
_get_first_arg ()
1701
1701
{
1702
1702
local i
@@ -1712,13 +1712,13 @@ _get_first_arg()
1712
1712
1713
1713
# This function counts the number of args, excluding options
1714
1714
# @param $1 chars Characters out of $COMP_WORDBREAKS which should
1715
- # NOT be considered word breaks. See __reassemble_comp_words_by_ref .
1715
+ # NOT be considered word breaks. See _comp__reassemble_comp_words_by_ref .
1716
1716
# @param $2 glob Options whose following argument should not be counted
1717
1717
# @param $3 glob Options that should be counted as args
1718
1718
_count_args ()
1719
1719
{
1720
1720
local i cword words
1721
- __reassemble_comp_words_by_ref " ${1-} " words cword
1721
+ _comp__reassemble_comp_words_by_ref " ${1-} " words cword
1722
1722
1723
1723
args=1
1724
1724
for (( i = 1 ; i < cword; i++ )) ; do
@@ -2177,7 +2177,7 @@ _comp_command_offset()
2177
2177
2178
2178
COMPREPLY=()
2179
2179
local cur
2180
- _get_comp_words_by_ref cur
2180
+ _comp_get_comp_words_by_ref cur
2181
2181
2182
2182
if (( COMP_CWORD == 0 )) ; then
2183
2183
local IFS=$' \n '
0 commit comments