@@ -747,6 +747,7 @@ _comp_quote_compgen()
747747# completions with `.$1' and the uppercase version of it as file
748748# extension.
749749#
750+ # TODO: rename per API conventions
750751_filedir ()
751752{
752753 _tilde " ${cur-} " || return
@@ -813,6 +814,7 @@ _comp__split_longopt()
813814# Complete variables.
814815# @return True (0) if variables were completed,
815816# False (> 0) if not.
817+ # TODO: rename per API conventions
816818_variables ()
817819{
818820 if [[ $cur =~ ^(\$ (\{ [! # ]?)?)([A-Za-z0-9_]*)$ ]]; then
@@ -1073,6 +1075,7 @@ _comp_initialize()
10731075
10741076# Helper function for _parse_help and _parse_usage.
10751077# @return True (0) if an option was found, False (> 0) otherwise
1078+ # TODO: rename per API conventions, rework to use vars rather than outputting
10761079__parse_options ()
10771080{
10781081 local option option2 i
@@ -1114,6 +1117,7 @@ __parse_options()
11141117# @param $1 command; if "-", read from stdin and ignore rest of args
11151118# @param $2 command options (default: --help)
11161119#
1120+ # TODO: rename per API conventions, rework to use vars rather than outputting
11171121_parse_help()
11181122{
11191123 local IFS=$' \t\n'
@@ -1154,6 +1158,7 @@ _parse_help()
11541158# @param $1 command; if "-", read from stdin and ignore rest of args
11551159# @param $2 command options (default: --usage)
11561160#
1161+ # TODO: rename per API conventions, rework to use vars rather than outputting
11571162_parse_usage()
11581163{
11591164 local IFS=$' \t\n'
@@ -1203,6 +1208,7 @@ _parse_usage()
12031208
12041209# This function completes on signal names (minus the SIG prefix)
12051210# @param $1 prefix
1211+ # TODO: rename per API conventions
12061212_signals ()
12071213{
12081214 local -a sigs
@@ -1212,6 +1218,7 @@ _signals()
12121218
12131219# This function completes on known mac addresses
12141220#
1221+ # TODO: rename per API conventions
12151222_mac_addresses ()
12161223{
12171224 local re=' \([A-Fa-f0-9]\{2\}:\)\{5\}[A-Fa-f0-9]\{2\}'
@@ -1251,6 +1258,7 @@ _mac_addresses()
12511258
12521259# This function completes on configured network interfaces
12531260#
1261+ # TODO: rename per API conventions
12541262_configured_interfaces ()
12551263{
12561264 local -a files
@@ -1288,6 +1296,7 @@ _configured_interfaces()
12881296# -6: IPv6 addresses only
12891297# -a: All addresses
12901298#
1299+ # TODO: rename per API conventions
12911300_ip_addresses ()
12921301{
12931302 local n
@@ -1307,6 +1316,7 @@ _ip_addresses()
13071316
13081317# This function completes on available kernels
13091318#
1319+ # TODO: rename per API conventions
13101320_kernel_versions ()
13111321{
13121322 _comp_compgen COMPREPLY -W ' $(command ls /lib/modules)' -- " $cur "
@@ -1316,6 +1326,7 @@ _kernel_versions()
13161326# -a: restrict to active interfaces only
13171327# -w: restrict to wireless interfaces only
13181328#
1329+ # TODO: rename per API conventions
13191330_available_interfaces ()
13201331{
13211332 local PATH=$PATH :/sbin
@@ -1334,6 +1345,7 @@ _available_interfaces()
13341345}
13351346
13361347# Echo number of CPUs, falling back to 1 on failure.
1348+ # TODO: rename per API conventions, rework to use vars rather than outputting
13371349_ncpus ()
13381350{
13391351 local var=NPROCESSORS_ONLN
@@ -1346,6 +1358,7 @@ _ncpus()
13461358# @return True (0) if completion needs further processing,
13471359# False (1) if tilde is followed by a valid username, completions are
13481360# put in COMPREPLY and no further processing is necessary.
1361+ # TODO: rename per API conventions
13491362_tilde ()
13501363{
13511364 if [[ ${1-} == \~ * && $1 != * /* ]]; then
@@ -1381,6 +1394,7 @@ _tilde()
13811394# ~foo/* /home/foo/*
13821395#
13831396# @param $1 Name of variable (not the value of the variable) to expand
1397+ # TODO: rename per API conventions
13841398__expand_tilde_by_ref ()
13851399{
13861400 if [[ ${! 1-} == \~ * ]]; then
@@ -1390,6 +1404,7 @@ __expand_tilde_by_ref()
13901404
13911405# This function expands tildes in pathnames
13921406#
1407+ # TODO: rename per API conventions
13931408_expand ()
13941409{
13951410 # Expand ~username type directory specifications. We want to expand
@@ -1410,6 +1425,7 @@ _expand()
14101425
14111426# Process ID related functions.
14121427# for AIX and Solaris we use X/Open syntax, BSD for others.
1428+ # TODO: rename per API conventions
14131429if [[ $OSTYPE == * @ (solaris| aix)* ]]; then
14141430 # This function completes on process IDs.
14151431 _pids ()
14881504
14891505# This function completes on user IDs
14901506#
1507+ # TODO: rename per API conventions
14911508_uids ()
14921509{
14931510 if type getent & > /dev/null; then
@@ -1502,6 +1519,7 @@ _uids()
15021519
15031520# This function completes on group IDs
15041521#
1522+ # TODO: rename per API conventions
15051523_gids ()
15061524{
15071525 if type getent & > /dev/null; then
@@ -1520,6 +1538,7 @@ _comp_backup_glob='@(#*#|*@(~|.@(bak|orig|rej|swp|dpkg*|rpm@(orig|new|save))))'
15201538
15211539# Complete on xinetd services
15221540#
1541+ # TODO: rename per API conventions
15231542_xinetd_services ()
15241543{
15251544 local xinetddir=${_comp__test_xinetd_dir:-/ etc/ xinetd.d}
@@ -1534,6 +1553,7 @@ _xinetd_services()
15341553
15351554# This function completes on services
15361555#
1556+ # TODO: rename per API conventions
15371557_services ()
15381558{
15391559 local sysvdirs
@@ -1559,7 +1579,11 @@ _services()
15591579# This completes on a list of all available service scripts for the
15601580# 'service' command and/or the SysV init.d directory, followed by
15611581# that script's available commands
1582+ # This function is in the main bash_completion file rather than in a separate
1583+ # one, because we set it up eagerly as completer for scripts in sysv init dirs
1584+ # below.
15621585#
1586+ # TODO: rename per API conventions, rework to use vars rather than outputting
15631587_service ()
15641588{
15651589 local cur prev words cword comp_args
@@ -1596,6 +1620,7 @@ _comp__init_set_up_service_completions
15961620
15971621# This function completes on modules
15981622#
1623+ # TODO: rename per API conventions (+ include "kernel" in the name)
15991624_modules ()
16001625{
16011626 local modpath
@@ -1607,6 +1632,7 @@ _modules()
16071632
16081633# This function completes on installed modules
16091634#
1635+ # TODO: rename per API conventions (+ include "kernel" in the name)
16101636_installed_modules ()
16111637{
16121638 _comp_compgen COMPREPLY -W " $( PATH=" $PATH :/sbin" lsmod |
@@ -1620,6 +1646,7 @@ _installed_modules()
16201646#
16211647# @param $1 If -u, only return users/groups the user has access to in
16221648# context of current completion.
1649+ # TODO: rename per API conventions
16231650_usergroup ()
16241651{
16251652 if [[ $cur == * \\\\ * || $cur == * :* :* ]]; then
@@ -1664,6 +1691,7 @@ _usergroup()
16641691 fi
16651692}
16661693
1694+ # TODO: rename per API conventions
16671695_allowed_users ()
16681696{
16691697 if _complete_as_root; then
@@ -1674,6 +1702,7 @@ _allowed_users()
16741702 fi
16751703}
16761704
1705+ # TODO: rename per API conventions
16771706_allowed_groups ()
16781707{
16791708 if _complete_as_root; then
@@ -1694,6 +1723,7 @@ _comp_selinux_users()
16941723# This function completes on valid shells
16951724#
16961725# @param $1 chroot to search from
1726+ # TODO: rename per API conventions
16971727_shells ()
16981728{
16991729 local shell rest
@@ -1704,6 +1734,7 @@ _shells()
17041734
17051735# This function completes on valid filesystem types
17061736#
1737+ # TODO: rename per API conventions
17071738_fstypes ()
17081739{
17091740 local fss
@@ -1769,6 +1800,7 @@ _comp_realcommand()
17691800# This function returns the first argument, excluding options
17701801# @param $1 chars Characters out of $COMP_WORDBREAKS which should
17711802# NOT be considered word breaks. See _comp__reassemble_words.
1803+ # TODO: rename per API conventions
17721804_get_first_arg ()
17731805{
17741806 local i
@@ -1787,6 +1819,7 @@ _get_first_arg()
17871819# NOT be considered word breaks. See _comp__reassemble_words.
17881820# @param $2 glob Options whose following argument should not be counted
17891821# @param $3 glob Options that should be counted as args
1822+ # TODO: rename per API conventions
17901823_count_args ()
17911824{
17921825 local i cword words
@@ -1804,6 +1837,7 @@ _count_args()
18041837
18051838# This function completes on PCI IDs
18061839#
1840+ # TODO: rename per API conventions
18071841_pci_ids ()
18081842{
18091843 _comp_compgen -a COMPREPLY -W \
@@ -1812,25 +1846,29 @@ _pci_ids()
18121846
18131847# This function completes on USB IDs
18141848#
1849+ # TODO: rename per API conventions
18151850_usb_ids ()
18161851{
18171852 _comp_compgen -a COMPREPLY -W \
18181853 " $( PATH=" $PATH :/sbin" lsusb | awk ' {print $6}' ) " -- " $cur "
18191854}
18201855
18211856# CD device names
1857+ # TODO: rename per API conventions
18221858_cd_devices ()
18231859{
18241860 _comp_compgen -a COMPREPLY -f -d -X " !*/?([amrs])cd*" -- " ${cur:-/ dev/ } "
18251861}
18261862
18271863# DVD device names
1864+ # TODO: rename per API conventions
18281865_dvd_devices ()
18291866{
18301867 _comp_compgen -a COMPREPLY -f -d -X " !*/?(r)dvd*" -- " ${cur:-/ dev/ } "
18311868}
18321869
18331870# TERM environment variable values
1871+ # TODO: rename per API conventions
18341872_terms ()
18351873{
18361874 _comp_compgen -a COMPREPLY -W " $( {
@@ -1845,6 +1883,7 @@ _terms()
18451883 } 2> /dev/null) " -- " $cur "
18461884}
18471885
1886+ # TODO: rename per API conventions
18481887_bashcomp_try_faketty ()
18491888{
18501889 if type unbuffer & > /dev/null; then
@@ -1864,6 +1903,7 @@ _bashcomp_try_faketty()
18641903
18651904# This function provides simple user@host completion
18661905#
1906+ # TODO: rename per API conventions
18671907_user_at_host ()
18681908{
18691909 local cur prev words cword comp_args
@@ -1880,6 +1920,7 @@ shopt -u hostcomplete && complete -F _user_at_host talk ytalk finger
18801920
18811921# NOTE: Using this function as a helper function is deprecated. Use
18821922# `_known_hosts_real' instead.
1923+ # TODO: rename per API conventions
18831924_known_hosts ()
18841925{
18851926 local cur prev words cword comp_args
@@ -1897,6 +1938,7 @@ _known_hosts()
18971938# Helper function to locate ssh included files in configs
18981939# This function looks for the "Include" keyword in ssh config files and
18991940# includes them recursively, adding each result to the config variable.
1941+ # TODO: rename per API conventions
19001942_included_ssh_config_files ()
19011943{
19021944 (( $# < 1 )) &&
@@ -1949,6 +1991,7 @@ _included_ssh_config_files()
19491991# -4 Filter IPv6 addresses from results
19501992# -6 Filter IPv4 addresses from results
19511993# @return Completions, starting with CWORD, are added to COMPREPLY[]
1994+ # TODO: rename per API conventions
19521995_known_hosts_real ()
19531996{
19541997 local configfile=" " flag prefix=" "
@@ -2306,6 +2349,7 @@ _comp_root_command()
23062349complete -F _comp_root_command fakeroot gksu gksudo kdesudo really
23072350
23082351# Return true if the completion should be treated as running as root
2352+ # TODO: rename per API conventions
23092353_complete_as_root ()
23102354{
23112355 [[ $EUID -eq 0 || ${root_command-} ]]
@@ -2371,6 +2415,7 @@ complete -F _comp_longopt \
23712415
23722416declare -Ag _xspecs
23732417
2418+ # TODO: rename per API conventions
23742419_filedir_xspec()
23752420{
23762421 local cur prev words cword comp_args
@@ -2410,6 +2455,7 @@ _filedir_xspec()
24102455 fi
24112456}
24122457
2458+ # TODO: rename per API conventions
24132459_install_xspec()
24142460{
24152461 local xspec=$1 cmd
@@ -2478,6 +2524,7 @@ _install_xspec '!*.@(mp[234c]|og[ag]|@(fl|a)ac|m4[abp]|spx|tta|w?(a)v|wma|aif?(f
24782524unset -f _install_xspec
24792525
24802526# Minimal completion to use as fallback in _completion_loader.
2527+ # TODO: rename per API conventions
24812528_minimal()
24822529{
24832530 local cur prev words cword comp_args
@@ -2488,6 +2535,7 @@ _minimal()
24882535# https://lists.gnu.org/archive/html/bug-bash/2012-01/msg00045.html
24892536complete -F _minimal ''
24902537
2538+ # TODO: rename per API conventions
24912539__load_completion()
24922540{
24932541 local cmd=$1 cmdname=${1##*/ } dir compfile
@@ -2606,6 +2654,7 @@ __load_completion()
26062654}
26072655
26082656# set up dynamic completion loading
2657+ # TODO: rename per API conventions
26092658_completion_loader()
26102659{
26112660 # $1 =_EmptycmD_ already for empty cmds in bash 4.3, set to it for earlier
0 commit comments