@@ -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
@@ -1563,6 +1583,7 @@ _services()
1563
1583
# one, because we set it up eagerly as completer for scripts in sysv init dirs
1564
1584
# below.
1565
1585
#
1586
+ # TODO: rename per API conventions, rework to use vars rather than outputting
1566
1587
_service ()
1567
1588
{
1568
1589
local cur prev words cword comp_args
@@ -1599,6 +1620,7 @@ _comp__init_set_up_service_completions
1599
1620
1600
1621
# This function completes on modules
1601
1622
#
1623
+ # TODO: rename per API conventions (+ include "kernel" in the name)
1602
1624
_modules ()
1603
1625
{
1604
1626
local modpath
@@ -1610,6 +1632,7 @@ _modules()
1610
1632
1611
1633
# This function completes on installed modules
1612
1634
#
1635
+ # TODO: rename per API conventions (+ include "kernel" in the name)
1613
1636
_installed_modules ()
1614
1637
{
1615
1638
_comp_compgen COMPREPLY -W " $( PATH=" $PATH :/sbin" lsmod |
@@ -1623,6 +1646,7 @@ _installed_modules()
1623
1646
#
1624
1647
# @param $1 If -u, only return users/groups the user has access to in
1625
1648
# context of current completion.
1649
+ # TODO: rename per API conventions
1626
1650
_usergroup ()
1627
1651
{
1628
1652
if [[ $cur == * \\\\ * || $cur == * :* :* ]]; then
@@ -1667,6 +1691,7 @@ _usergroup()
1667
1691
fi
1668
1692
}
1669
1693
1694
+ # TODO: rename per API conventions
1670
1695
_allowed_users ()
1671
1696
{
1672
1697
if _complete_as_root; then
@@ -1677,6 +1702,7 @@ _allowed_users()
1677
1702
fi
1678
1703
}
1679
1704
1705
+ # TODO: rename per API conventions
1680
1706
_allowed_groups ()
1681
1707
{
1682
1708
if _complete_as_root; then
@@ -1697,6 +1723,7 @@ _comp_selinux_users()
1697
1723
# This function completes on valid shells
1698
1724
#
1699
1725
# @param $1 chroot to search from
1726
+ # TODO: rename per API conventions
1700
1727
_shells ()
1701
1728
{
1702
1729
local shell rest
@@ -1707,6 +1734,7 @@ _shells()
1707
1734
1708
1735
# This function completes on valid filesystem types
1709
1736
#
1737
+ # TODO: rename per API conventions
1710
1738
_fstypes ()
1711
1739
{
1712
1740
local fss
@@ -1772,6 +1800,7 @@ _comp_realcommand()
1772
1800
# This function returns the first argument, excluding options
1773
1801
# @param $1 chars Characters out of $COMP_WORDBREAKS which should
1774
1802
# NOT be considered word breaks. See _comp__reassemble_words.
1803
+ # TODO: rename per API conventions
1775
1804
_get_first_arg ()
1776
1805
{
1777
1806
local i
@@ -1790,6 +1819,7 @@ _get_first_arg()
1790
1819
# NOT be considered word breaks. See _comp__reassemble_words.
1791
1820
# @param $2 glob Options whose following argument should not be counted
1792
1821
# @param $3 glob Options that should be counted as args
1822
+ # TODO: rename per API conventions
1793
1823
_count_args ()
1794
1824
{
1795
1825
local i cword words
@@ -1807,6 +1837,7 @@ _count_args()
1807
1837
1808
1838
# This function completes on PCI IDs
1809
1839
#
1840
+ # TODO: rename per API conventions
1810
1841
_pci_ids ()
1811
1842
{
1812
1843
_comp_compgen -a COMPREPLY -W \
@@ -1815,25 +1846,29 @@ _pci_ids()
1815
1846
1816
1847
# This function completes on USB IDs
1817
1848
#
1849
+ # TODO: rename per API conventions
1818
1850
_usb_ids ()
1819
1851
{
1820
1852
_comp_compgen -a COMPREPLY -W \
1821
1853
" $( PATH=" $PATH :/sbin" lsusb | awk ' {print $6}' ) " -- " $cur "
1822
1854
}
1823
1855
1824
1856
# CD device names
1857
+ # TODO: rename per API conventions
1825
1858
_cd_devices ()
1826
1859
{
1827
1860
_comp_compgen -a COMPREPLY -f -d -X " !*/?([amrs])cd*" -- " ${cur:-/ dev/ } "
1828
1861
}
1829
1862
1830
1863
# DVD device names
1864
+ # TODO: rename per API conventions
1831
1865
_dvd_devices ()
1832
1866
{
1833
1867
_comp_compgen -a COMPREPLY -f -d -X " !*/?(r)dvd*" -- " ${cur:-/ dev/ } "
1834
1868
}
1835
1869
1836
1870
# TERM environment variable values
1871
+ # TODO: rename per API conventions
1837
1872
_terms ()
1838
1873
{
1839
1874
_comp_compgen -a COMPREPLY -W " $( {
@@ -1848,6 +1883,7 @@ _terms()
1848
1883
} 2> /dev/null) " -- " $cur "
1849
1884
}
1850
1885
1886
+ # TODO: rename per API conventions
1851
1887
_bashcomp_try_faketty ()
1852
1888
{
1853
1889
if type unbuffer & > /dev/null; then
@@ -1867,6 +1903,7 @@ _bashcomp_try_faketty()
1867
1903
1868
1904
# This function provides simple user@host completion
1869
1905
#
1906
+ # TODO: rename per API conventions
1870
1907
_user_at_host ()
1871
1908
{
1872
1909
local cur prev words cword comp_args
@@ -1883,6 +1920,7 @@ shopt -u hostcomplete && complete -F _user_at_host talk ytalk finger
1883
1920
1884
1921
# NOTE: Using this function as a helper function is deprecated. Use
1885
1922
# `_known_hosts_real' instead.
1923
+ # TODO: rename per API conventions
1886
1924
_known_hosts ()
1887
1925
{
1888
1926
local cur prev words cword comp_args
@@ -1900,6 +1938,7 @@ _known_hosts()
1900
1938
# Helper function to locate ssh included files in configs
1901
1939
# This function looks for the "Include" keyword in ssh config files and
1902
1940
# includes them recursively, adding each result to the config variable.
1941
+ # TODO: rename per API conventions
1903
1942
_included_ssh_config_files ()
1904
1943
{
1905
1944
(( $# < 1 )) &&
@@ -1952,6 +1991,7 @@ _included_ssh_config_files()
1952
1991
# -4 Filter IPv6 addresses from results
1953
1992
# -6 Filter IPv4 addresses from results
1954
1993
# @return Completions, starting with CWORD, are added to COMPREPLY[]
1994
+ # TODO: rename per API conventions
1955
1995
_known_hosts_real ()
1956
1996
{
1957
1997
local configfile=" " flag prefix=" "
@@ -2309,6 +2349,7 @@ _comp_root_command()
2309
2349
complete -F _comp_root_command fakeroot gksu gksudo kdesudo really
2310
2350
2311
2351
# Return true if the completion should be treated as running as root
2352
+ # TODO: rename per API conventions
2312
2353
_complete_as_root ()
2313
2354
{
2314
2355
[[ $EUID -eq 0 || ${root_command-} ]]
@@ -2374,6 +2415,7 @@ complete -F _comp_longopt \
2374
2415
2375
2416
declare -Ag _xspecs
2376
2417
2418
+ # TODO: rename per API conventions
2377
2419
_filedir_xspec()
2378
2420
{
2379
2421
local cur prev words cword comp_args
@@ -2413,6 +2455,7 @@ _filedir_xspec()
2413
2455
fi
2414
2456
}
2415
2457
2458
+ # TODO: rename per API conventions
2416
2459
_install_xspec()
2417
2460
{
2418
2461
local xspec=$1 cmd
@@ -2481,6 +2524,7 @@ _install_xspec '!*.@(mp[234c]|og[ag]|@(fl|a)ac|m4[abp]|spx|tta|w?(a)v|wma|aif?(f
2481
2524
unset -f _install_xspec
2482
2525
2483
2526
# Minimal completion to use as fallback in _completion_loader.
2527
+ # TODO: rename per API conventions
2484
2528
_minimal()
2485
2529
{
2486
2530
local cur prev words cword comp_args
@@ -2491,6 +2535,7 @@ _minimal()
2491
2535
# https://lists.gnu.org/archive/html/bug-bash/2012-01/msg00045.html
2492
2536
complete -F _minimal ''
2493
2537
2538
+ # TODO: rename per API conventions
2494
2539
__load_completion()
2495
2540
{
2496
2541
local cmd=$1 cmdname=${1##*/ } dir compfile
@@ -2609,6 +2654,7 @@ __load_completion()
2609
2654
}
2610
2655
2611
2656
# set up dynamic completion loading
2657
+ # TODO: rename per API conventions
2612
2658
_completion_loader()
2613
2659
{
2614
2660
# $1 =_EmptycmD_ already for empty cmds in bash 4.3, set to it for earlier
0 commit comments