Skip to content

Commit e083839

Browse files
committed
docs: mark functions needing rename/refactoring as TODO
1 parent 5af5647 commit e083839

File tree

13 files changed

+83
-0
lines changed

13 files changed

+83
-0
lines changed

bash_completion

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
14131429
if [[ $OSTYPE == *@(solaris|aix)* ]]; then
14141430
# This function completes on process IDs.
14151431
_pids()
@@ -1488,6 +1504,7 @@ fi
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
@@ -1563,6 +1583,7 @@ _services()
15631583
# one, because we set it up eagerly as completer for scripts in sysv init dirs
15641584
# below.
15651585
#
1586+
# TODO: rename per API conventions, rework to use vars rather than outputting
15661587
_service()
15671588
{
15681589
local cur prev words cword comp_args
@@ -1599,6 +1620,7 @@ _comp__init_set_up_service_completions
15991620

16001621
# This function completes on modules
16011622
#
1623+
# TODO: rename per API conventions (+ include "kernel" in the name)
16021624
_modules()
16031625
{
16041626
local modpath
@@ -1610,6 +1632,7 @@ _modules()
16101632

16111633
# This function completes on installed modules
16121634
#
1635+
# TODO: rename per API conventions (+ include "kernel" in the name)
16131636
_installed_modules()
16141637
{
16151638
_comp_compgen COMPREPLY -W "$(PATH="$PATH:/sbin" lsmod |
@@ -1623,6 +1646,7 @@ _installed_modules()
16231646
#
16241647
# @param $1 If -u, only return users/groups the user has access to in
16251648
# context of current completion.
1649+
# TODO: rename per API conventions
16261650
_usergroup()
16271651
{
16281652
if [[ $cur == *\\\\* || $cur == *:*:* ]]; then
@@ -1667,6 +1691,7 @@ _usergroup()
16671691
fi
16681692
}
16691693

1694+
# TODO: rename per API conventions
16701695
_allowed_users()
16711696
{
16721697
if _complete_as_root; then
@@ -1677,6 +1702,7 @@ _allowed_users()
16771702
fi
16781703
}
16791704

1705+
# TODO: rename per API conventions
16801706
_allowed_groups()
16811707
{
16821708
if _complete_as_root; then
@@ -1697,6 +1723,7 @@ _comp_selinux_users()
16971723
# This function completes on valid shells
16981724
#
16991725
# @param $1 chroot to search from
1726+
# TODO: rename per API conventions
17001727
_shells()
17011728
{
17021729
local shell rest
@@ -1707,6 +1734,7 @@ _shells()
17071734

17081735
# This function completes on valid filesystem types
17091736
#
1737+
# TODO: rename per API conventions
17101738
_fstypes()
17111739
{
17121740
local fss
@@ -1772,6 +1800,7 @@ _comp_realcommand()
17721800
# This function returns the first argument, excluding options
17731801
# @param $1 chars Characters out of $COMP_WORDBREAKS which should
17741802
# NOT be considered word breaks. See _comp__reassemble_words.
1803+
# TODO: rename per API conventions
17751804
_get_first_arg()
17761805
{
17771806
local i
@@ -1790,6 +1819,7 @@ _get_first_arg()
17901819
# NOT be considered word breaks. See _comp__reassemble_words.
17911820
# @param $2 glob Options whose following argument should not be counted
17921821
# @param $3 glob Options that should be counted as args
1822+
# TODO: rename per API conventions
17931823
_count_args()
17941824
{
17951825
local i cword words
@@ -1807,6 +1837,7 @@ _count_args()
18071837

18081838
# This function completes on PCI IDs
18091839
#
1840+
# TODO: rename per API conventions
18101841
_pci_ids()
18111842
{
18121843
_comp_compgen -a COMPREPLY -W \
@@ -1815,25 +1846,29 @@ _pci_ids()
18151846

18161847
# This function completes on USB IDs
18171848
#
1849+
# TODO: rename per API conventions
18181850
_usb_ids()
18191851
{
18201852
_comp_compgen -a COMPREPLY -W \
18211853
"$(PATH="$PATH:/sbin" lsusb | awk '{print $6}')" -- "$cur"
18221854
}
18231855

18241856
# CD device names
1857+
# TODO: rename per API conventions
18251858
_cd_devices()
18261859
{
18271860
_comp_compgen -a COMPREPLY -f -d -X "!*/?([amrs])cd*" -- "${cur:-/dev/}"
18281861
}
18291862

18301863
# DVD device names
1864+
# TODO: rename per API conventions
18311865
_dvd_devices()
18321866
{
18331867
_comp_compgen -a COMPREPLY -f -d -X "!*/?(r)dvd*" -- "${cur:-/dev/}"
18341868
}
18351869

18361870
# TERM environment variable values
1871+
# TODO: rename per API conventions
18371872
_terms()
18381873
{
18391874
_comp_compgen -a COMPREPLY -W "$({
@@ -1848,6 +1883,7 @@ _terms()
18481883
} 2>/dev/null)" -- "$cur"
18491884
}
18501885

1886+
# TODO: rename per API conventions
18511887
_bashcomp_try_faketty()
18521888
{
18531889
if type unbuffer &>/dev/null; then
@@ -1867,6 +1903,7 @@ _bashcomp_try_faketty()
18671903

18681904
# This function provides simple user@host completion
18691905
#
1906+
# TODO: rename per API conventions
18701907
_user_at_host()
18711908
{
18721909
local cur prev words cword comp_args
@@ -1883,6 +1920,7 @@ shopt -u hostcomplete && complete -F _user_at_host talk ytalk finger
18831920

18841921
# NOTE: Using this function as a helper function is deprecated. Use
18851922
# `_known_hosts_real' instead.
1923+
# TODO: rename per API conventions
18861924
_known_hosts()
18871925
{
18881926
local cur prev words cword comp_args
@@ -1900,6 +1938,7 @@ _known_hosts()
19001938
# Helper function to locate ssh included files in configs
19011939
# This function looks for the "Include" keyword in ssh config files and
19021940
# includes them recursively, adding each result to the config variable.
1941+
# TODO: rename per API conventions
19031942
_included_ssh_config_files()
19041943
{
19051944
(($# < 1)) &&
@@ -1952,6 +1991,7 @@ _included_ssh_config_files()
19521991
# -4 Filter IPv6 addresses from results
19531992
# -6 Filter IPv4 addresses from results
19541993
# @return Completions, starting with CWORD, are added to COMPREPLY[]
1994+
# TODO: rename per API conventions
19551995
_known_hosts_real()
19561996
{
19571997
local configfile="" flag prefix=""
@@ -2309,6 +2349,7 @@ _comp_root_command()
23092349
complete -F _comp_root_command fakeroot gksu gksudo kdesudo really
23102350

23112351
# Return true if the completion should be treated as running as root
2352+
# TODO: rename per API conventions
23122353
_complete_as_root()
23132354
{
23142355
[[ $EUID -eq 0 || ${root_command-} ]]
@@ -2374,6 +2415,7 @@ complete -F _comp_longopt \
23742415
23752416
declare -Ag _xspecs
23762417
2418+
# TODO: rename per API conventions
23772419
_filedir_xspec()
23782420
{
23792421
local cur prev words cword comp_args
@@ -2413,6 +2455,7 @@ _filedir_xspec()
24132455
fi
24142456
}
24152457
2458+
# TODO: rename per API conventions
24162459
_install_xspec()
24172460
{
24182461
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
24812524
unset -f _install_xspec
24822525
24832526
# Minimal completion to use as fallback in _completion_loader.
2527+
# TODO: rename per API conventions
24842528
_minimal()
24852529
{
24862530
local cur prev words cword comp_args
@@ -2491,6 +2535,7 @@ _minimal()
24912535
# https://lists.gnu.org/archive/html/bug-bash/2012-01/msg00045.html
24922536
complete -F _minimal ''
24932537
2538+
# TODO: rename per API conventions
24942539
__load_completion()
24952540
{
24962541
local cmd=$1 cmdname=${1##*/} dir compfile
@@ -2609,6 +2654,7 @@ __load_completion()
26092654
}
26102655
26112656
# set up dynamic completion loading
2657+
# TODO: rename per API conventions
26122658
_completion_loader()
26132659
{
26142660
# $1=_EmptycmD_ already for empty cmds in bash 4.3, set to it for earlier

completions/_modules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,21 @@
2121
# being sourced before it and thus before the `module' alias has been defined.
2222
[[ -f /etc/profile.d/modules.sh ]] || return 1
2323

24+
# TODO: rename per API conventions, rework to use vars rather than outputting
2425
_module_list()
2526
{
2627
local modules="$(command sed 's/:/ /g' <<<"$LOADEDMODULES" | sort)"
2728
compgen -W "$modules" -- "$1"
2829
}
2930

31+
# TODO: rename per API conventions, rework to use vars rather than outputting
3032
_module_path()
3133
{
3234
local modules="$(command sed 's/:/ /g' <<<"$MODULEPATH" | sort)"
3335
compgen -W "$modules" -- "$1"
3436
}
3537

38+
# TODO: rename per API conventions, rework to use vars rather than outputting
3639
_module_avail()
3740
{
3841
local modules="$(

0 commit comments

Comments
 (0)