@@ -747,6 +747,7 @@ _comp_quote_compgen()
747
747
# completions with `.$1' and the uppercase version of it as file
748
748
# extension.
749
749
#
750
+ # TODO: rename per API conventions
750
751
_filedir ()
751
752
{
752
753
_tilde " ${cur-} " || return
@@ -813,6 +814,7 @@ _comp__split_longopt()
813
814
# Complete variables.
814
815
# @return True (0) if variables were completed,
815
816
# False (> 0) if not.
817
+ # TODO: rename per API conventions
816
818
_variables ()
817
819
{
818
820
if [[ $cur =~ ^(\$ (\{ [! # ]?)?)([A-Za-z0-9_]*)$ ]]; then
@@ -1073,6 +1075,7 @@ _comp_initialize()
1073
1075
1074
1076
# Helper function for _parse_help and _parse_usage.
1075
1077
# @return True (0) if an option was found, False (> 0) otherwise
1078
+ # TODO: rename per API conventions, rework to use vars rather than outputting
1076
1079
__parse_options ()
1077
1080
{
1078
1081
local option option2 i
@@ -1114,6 +1117,7 @@ __parse_options()
1114
1117
# @param $1 command; if "-", read from stdin and ignore rest of args
1115
1118
# @param $2 command options (default: --help)
1116
1119
#
1120
+ # TODO: rename per API conventions, rework to use vars rather than outputting
1117
1121
_parse_help()
1118
1122
{
1119
1123
local IFS=$' \t\n'
@@ -1154,6 +1158,7 @@ _parse_help()
1154
1158
# @param $1 command; if "-", read from stdin and ignore rest of args
1155
1159
# @param $2 command options (default: --usage)
1156
1160
#
1161
+ # TODO: rename per API conventions, rework to use vars rather than outputting
1157
1162
_parse_usage()
1158
1163
{
1159
1164
local IFS=$' \t\n'
@@ -1203,6 +1208,7 @@ _parse_usage()
1203
1208
1204
1209
# This function completes on signal names (minus the SIG prefix)
1205
1210
# @param $1 prefix
1211
+ # TODO: rename per API conventions
1206
1212
_signals ()
1207
1213
{
1208
1214
local -a sigs
@@ -1212,6 +1218,7 @@ _signals()
1212
1218
1213
1219
# This function completes on known mac addresses
1214
1220
#
1221
+ # TODO: rename per API conventions
1215
1222
_mac_addresses ()
1216
1223
{
1217
1224
local re=' \([A-Fa-f0-9]\{2\}:\)\{5\}[A-Fa-f0-9]\{2\}'
@@ -1251,6 +1258,7 @@ _mac_addresses()
1251
1258
1252
1259
# This function completes on configured network interfaces
1253
1260
#
1261
+ # TODO: rename per API conventions
1254
1262
_configured_interfaces ()
1255
1263
{
1256
1264
local -a files
@@ -1288,6 +1296,7 @@ _configured_interfaces()
1288
1296
# -6: IPv6 addresses only
1289
1297
# -a: All addresses
1290
1298
#
1299
+ # TODO: rename per API conventions
1291
1300
_ip_addresses ()
1292
1301
{
1293
1302
local n
@@ -1307,6 +1316,7 @@ _ip_addresses()
1307
1316
1308
1317
# This function completes on available kernels
1309
1318
#
1319
+ # TODO: rename per API conventions
1310
1320
_kernel_versions ()
1311
1321
{
1312
1322
_comp_compgen COMPREPLY -W ' $(command ls /lib/modules)' -- " $cur "
@@ -1316,6 +1326,7 @@ _kernel_versions()
1316
1326
# -a: restrict to active interfaces only
1317
1327
# -w: restrict to wireless interfaces only
1318
1328
#
1329
+ # TODO: rename per API conventions
1319
1330
_available_interfaces ()
1320
1331
{
1321
1332
local PATH=$PATH :/sbin
@@ -1334,6 +1345,7 @@ _available_interfaces()
1334
1345
}
1335
1346
1336
1347
# Echo number of CPUs, falling back to 1 on failure.
1348
+ # TODO: rename per API conventions, rework to use vars rather than outputting
1337
1349
_ncpus ()
1338
1350
{
1339
1351
local var=NPROCESSORS_ONLN
@@ -1346,6 +1358,7 @@ _ncpus()
1346
1358
# @return True (0) if completion needs further processing,
1347
1359
# False (1) if tilde is followed by a valid username, completions are
1348
1360
# put in COMPREPLY and no further processing is necessary.
1361
+ # TODO: rename per API conventions
1349
1362
_tilde ()
1350
1363
{
1351
1364
if [[ ${1-} == \~ * && $1 != * /* ]]; then
@@ -1381,6 +1394,7 @@ _tilde()
1381
1394
# ~foo/* /home/foo/*
1382
1395
#
1383
1396
# @param $1 Name of variable (not the value of the variable) to expand
1397
+ # TODO: rename per API conventions
1384
1398
__expand_tilde_by_ref ()
1385
1399
{
1386
1400
if [[ ${! 1-} == \~ * ]]; then
@@ -1390,6 +1404,7 @@ __expand_tilde_by_ref()
1390
1404
1391
1405
# This function expands tildes in pathnames
1392
1406
#
1407
+ # TODO: rename per API conventions
1393
1408
_expand ()
1394
1409
{
1395
1410
# Expand ~username type directory specifications. We want to expand
@@ -1410,6 +1425,7 @@ _expand()
1410
1425
1411
1426
# Process ID related functions.
1412
1427
# for AIX and Solaris we use X/Open syntax, BSD for others.
1428
+ # TODO: rename per API conventions
1413
1429
if [[ $OSTYPE == * @ (solaris| aix)* ]]; then
1414
1430
# This function completes on process IDs.
1415
1431
_pids ()
1488
1504
1489
1505
# This function completes on user IDs
1490
1506
#
1507
+ # TODO: rename per API conventions
1491
1508
_uids ()
1492
1509
{
1493
1510
if type getent & > /dev/null; then
@@ -1502,6 +1519,7 @@ _uids()
1502
1519
1503
1520
# This function completes on group IDs
1504
1521
#
1522
+ # TODO: rename per API conventions
1505
1523
_gids ()
1506
1524
{
1507
1525
if type getent & > /dev/null; then
@@ -1520,6 +1538,7 @@ _comp_backup_glob='@(#*#|*@(~|.@(bak|orig|rej|swp|dpkg*|rpm@(orig|new|save))))'
1520
1538
1521
1539
# Complete on xinetd services
1522
1540
#
1541
+ # TODO: rename per API conventions
1523
1542
_xinetd_services ()
1524
1543
{
1525
1544
local xinetddir=${_comp__test_xinetd_dir:-/ etc/ xinetd.d}
@@ -1534,6 +1553,7 @@ _xinetd_services()
1534
1553
1535
1554
# This function completes on services
1536
1555
#
1556
+ # TODO: rename per API conventions
1537
1557
_services ()
1538
1558
{
1539
1559
local sysvdirs
@@ -1559,7 +1579,11 @@ _services()
1559
1579
# This completes on a list of all available service scripts for the
1560
1580
# 'service' command and/or the SysV init.d directory, followed by
1561
1581
# 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.
1562
1585
#
1586
+ # TODO: rename per API conventions, rework to use vars rather than outputting
1563
1587
_service ()
1564
1588
{
1565
1589
local cur prev words cword comp_args
@@ -1596,6 +1620,7 @@ _comp__init_set_up_service_completions
1596
1620
1597
1621
# This function completes on modules
1598
1622
#
1623
+ # TODO: rename per API conventions (+ include "kernel" in the name)
1599
1624
_modules ()
1600
1625
{
1601
1626
local modpath
@@ -1607,6 +1632,7 @@ _modules()
1607
1632
1608
1633
# This function completes on installed modules
1609
1634
#
1635
+ # TODO: rename per API conventions (+ include "kernel" in the name)
1610
1636
_installed_modules ()
1611
1637
{
1612
1638
_comp_compgen COMPREPLY -W " $( PATH=" $PATH :/sbin" lsmod |
@@ -1620,6 +1646,7 @@ _installed_modules()
1620
1646
#
1621
1647
# @param $1 If -u, only return users/groups the user has access to in
1622
1648
# context of current completion.
1649
+ # TODO: rename per API conventions
1623
1650
_usergroup ()
1624
1651
{
1625
1652
if [[ $cur == * \\\\ * || $cur == * :* :* ]]; then
@@ -1664,6 +1691,7 @@ _usergroup()
1664
1691
fi
1665
1692
}
1666
1693
1694
+ # TODO: rename per API conventions
1667
1695
_allowed_users ()
1668
1696
{
1669
1697
if _complete_as_root; then
@@ -1674,6 +1702,7 @@ _allowed_users()
1674
1702
fi
1675
1703
}
1676
1704
1705
+ # TODO: rename per API conventions
1677
1706
_allowed_groups ()
1678
1707
{
1679
1708
if _complete_as_root; then
@@ -1694,6 +1723,7 @@ _comp_selinux_users()
1694
1723
# This function completes on valid shells
1695
1724
#
1696
1725
# @param $1 chroot to search from
1726
+ # TODO: rename per API conventions
1697
1727
_shells ()
1698
1728
{
1699
1729
local shell rest
@@ -1704,6 +1734,7 @@ _shells()
1704
1734
1705
1735
# This function completes on valid filesystem types
1706
1736
#
1737
+ # TODO: rename per API conventions
1707
1738
_fstypes ()
1708
1739
{
1709
1740
local fss
@@ -1769,6 +1800,7 @@ _comp_realcommand()
1769
1800
# This function returns the first argument, excluding options
1770
1801
# @param $1 chars Characters out of $COMP_WORDBREAKS which should
1771
1802
# NOT be considered word breaks. See _comp__reassemble_words.
1803
+ # TODO: rename per API conventions
1772
1804
_get_first_arg ()
1773
1805
{
1774
1806
local i
@@ -1787,6 +1819,7 @@ _get_first_arg()
1787
1819
# NOT be considered word breaks. See _comp__reassemble_words.
1788
1820
# @param $2 glob Options whose following argument should not be counted
1789
1821
# @param $3 glob Options that should be counted as args
1822
+ # TODO: rename per API conventions
1790
1823
_count_args ()
1791
1824
{
1792
1825
local i cword words
@@ -1804,6 +1837,7 @@ _count_args()
1804
1837
1805
1838
# This function completes on PCI IDs
1806
1839
#
1840
+ # TODO: rename per API conventions
1807
1841
_pci_ids ()
1808
1842
{
1809
1843
_comp_compgen -a COMPREPLY -W \
@@ -1812,25 +1846,29 @@ _pci_ids()
1812
1846
1813
1847
# This function completes on USB IDs
1814
1848
#
1849
+ # TODO: rename per API conventions
1815
1850
_usb_ids ()
1816
1851
{
1817
1852
_comp_compgen -a COMPREPLY -W \
1818
1853
" $( PATH=" $PATH :/sbin" lsusb | awk ' {print $6}' ) " -- " $cur "
1819
1854
}
1820
1855
1821
1856
# CD device names
1857
+ # TODO: rename per API conventions
1822
1858
_cd_devices ()
1823
1859
{
1824
1860
_comp_compgen -a COMPREPLY -f -d -X " !*/?([amrs])cd*" -- " ${cur:-/ dev/ } "
1825
1861
}
1826
1862
1827
1863
# DVD device names
1864
+ # TODO: rename per API conventions
1828
1865
_dvd_devices ()
1829
1866
{
1830
1867
_comp_compgen -a COMPREPLY -f -d -X " !*/?(r)dvd*" -- " ${cur:-/ dev/ } "
1831
1868
}
1832
1869
1833
1870
# TERM environment variable values
1871
+ # TODO: rename per API conventions
1834
1872
_terms ()
1835
1873
{
1836
1874
_comp_compgen -a COMPREPLY -W " $( {
@@ -1845,6 +1883,7 @@ _terms()
1845
1883
} 2> /dev/null) " -- " $cur "
1846
1884
}
1847
1885
1886
+ # TODO: rename per API conventions
1848
1887
_bashcomp_try_faketty ()
1849
1888
{
1850
1889
if type unbuffer & > /dev/null; then
@@ -1864,6 +1903,7 @@ _bashcomp_try_faketty()
1864
1903
1865
1904
# This function provides simple user@host completion
1866
1905
#
1906
+ # TODO: rename per API conventions
1867
1907
_user_at_host ()
1868
1908
{
1869
1909
local cur prev words cword comp_args
@@ -1880,6 +1920,7 @@ shopt -u hostcomplete && complete -F _user_at_host talk ytalk finger
1880
1920
1881
1921
# NOTE: Using this function as a helper function is deprecated. Use
1882
1922
# `_known_hosts_real' instead.
1923
+ # TODO: rename per API conventions
1883
1924
_known_hosts ()
1884
1925
{
1885
1926
local cur prev words cword comp_args
@@ -1897,6 +1938,7 @@ _known_hosts()
1897
1938
# Helper function to locate ssh included files in configs
1898
1939
# This function looks for the "Include" keyword in ssh config files and
1899
1940
# includes them recursively, adding each result to the config variable.
1941
+ # TODO: rename per API conventions
1900
1942
_included_ssh_config_files ()
1901
1943
{
1902
1944
(( $# < 1 )) &&
@@ -1949,6 +1991,7 @@ _included_ssh_config_files()
1949
1991
# -4 Filter IPv6 addresses from results
1950
1992
# -6 Filter IPv4 addresses from results
1951
1993
# @return Completions, starting with CWORD, are added to COMPREPLY[]
1994
+ # TODO: rename per API conventions
1952
1995
_known_hosts_real ()
1953
1996
{
1954
1997
local configfile=" " flag prefix=" "
@@ -2306,6 +2349,7 @@ _comp_root_command()
2306
2349
complete -F _comp_root_command fakeroot gksu gksudo kdesudo really
2307
2350
2308
2351
# Return true if the completion should be treated as running as root
2352
+ # TODO: rename per API conventions
2309
2353
_complete_as_root ()
2310
2354
{
2311
2355
[[ $EUID -eq 0 || ${root_command-} ]]
@@ -2371,6 +2415,7 @@ complete -F _comp_longopt \
2371
2415
2372
2416
declare -Ag _xspecs
2373
2417
2418
+ # TODO: rename per API conventions
2374
2419
_filedir_xspec()
2375
2420
{
2376
2421
local cur prev words cword comp_args
@@ -2410,6 +2455,7 @@ _filedir_xspec()
2410
2455
fi
2411
2456
}
2412
2457
2458
+ # TODO: rename per API conventions
2413
2459
_install_xspec()
2414
2460
{
2415
2461
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
2478
2524
unset -f _install_xspec
2479
2525
2480
2526
# Minimal completion to use as fallback in _completion_loader.
2527
+ # TODO: rename per API conventions
2481
2528
_minimal()
2482
2529
{
2483
2530
local cur prev words cword comp_args
@@ -2488,6 +2535,7 @@ _minimal()
2488
2535
# https://lists.gnu.org/archive/html/bug-bash/2012-01/msg00045.html
2489
2536
complete -F _minimal ''
2490
2537
2538
+ # TODO: rename per API conventions
2491
2539
__load_completion()
2492
2540
{
2493
2541
local cmd=$1 cmdname=${1##*/ } dir compfile
@@ -2606,6 +2654,7 @@ __load_completion()
2606
2654
}
2607
2655
2608
2656
# set up dynamic completion loading
2657
+ # TODO: rename per API conventions
2609
2658
_completion_loader()
2610
2659
{
2611
2660
# $1 =_EmptycmD_ already for empty cmds in bash 4.3, set to it for earlier
0 commit comments