Skip to content

Commit 4d50451

Browse files
committed
refactor: use _comp_compgen_filedir
1 parent 5807f4b commit 4d50451

File tree

326 files changed

+794
-791
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

326 files changed

+794
-791
lines changed

bash_completion

+18-15
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ _comp_variable_assignments()
10121012
case $prev in
10131013
TZ)
10141014
cur=/usr/share/zoneinfo/$cur
1015-
_filedir
1015+
_comp_compgen -a filedir
10161016
if ((${#COMPREPLY[@]})); then
10171017
for i in "${!COMPREPLY[@]}"; do
10181018
if [[ ${COMPREPLY[i]} == *.tab ]]; then
@@ -1037,7 +1037,7 @@ _comp_variable_assignments()
10371037
;;
10381038
*)
10391039
_variables && return 0
1040-
_filedir
1040+
_comp_compgen -a filedir
10411041
;;
10421042
esac
10431043

@@ -1052,9 +1052,12 @@ _comp_variable_assignments()
10521052
#
10531053
# Options:
10541054
# -n EXCLUDE Passed to _comp_get_words -n with redirection chars
1055-
# -e XSPEC Passed to _filedir as first arg for stderr redirections
1056-
# -o XSPEC Passed to _filedir as first arg for other output redirections
1057-
# -i XSPEC Passed to _filedir as first arg for stdin redirections
1055+
# -e XSPEC Passed to _comp_compgen_filedir as first arg for stderr
1056+
# redirections
1057+
# -o XSPEC Passed to _comp_compgen_filedir as first arg for other output
1058+
# redirections
1059+
# -i XSPEC Passed to _comp_compgen_filedir as first arg for stdin
1060+
# redirections
10581061
# -s Split long options with _comp__split_longopt, implies -n =
10591062
# @param $1...$3 args Original arguments specified to the completion function.
10601063
# The first argument $1 is command name. The second
@@ -1065,9 +1068,9 @@ _comp_variable_assignments()
10651068
# @var[out] prev Reconstructed previous word
10661069
# @var[out] words Reconstructed words
10671070
# @var[out] cword Current word index in `words`
1068-
# @var[out] comp_args Original arguments specified to the completion function
1069-
# are saved in this array, if the arguments $1...$3 is
1070-
# specified.
1071+
# @var[out] comp_args Original arguments specified to the completion
1072+
# function are saved in this array, if the arguments
1073+
# $1...$3 is specified.
10711074
# @var[out,opt] was_split When "-s" is specified, `"set"/""` is set depending
10721075
# on whether the split happened.
10731076
# @return True (0) if completion needs further processing,
@@ -1123,7 +1126,7 @@ _comp_initialize()
11231126
;;
11241127
esac
11251128
cur=${cur##"$redir"}
1126-
_filedir "$xspec"
1129+
_comp_compgen -a filedir "$xspec"
11271130
return 1
11281131
fi
11291132

@@ -2469,23 +2472,23 @@ _comp_longopt()
24692472
return
24702473
;;
24712474
--!(no-*)dir*)
2472-
_filedir -d
2475+
_comp_compgen -a filedir -d
24732476
return
24742477
;;
24752478
--!(no-*)@(file|path)*)
2476-
_filedir
2479+
_comp_compgen -a filedir
24772480
return
24782481
;;
24792482
--+([-a-z0-9_]))
24802483
local argtype=$(LC_ALL=C $1 --help 2>&1 | command sed -ne \
24812484
"s|.*$prev\[\{0,1\}=[<[]\{0,1\}\([-A-Za-z0-9_]\{1,\}\).*|\1|p")
24822485
case ${argtype,,} in
24832486
*dir*)
2484-
_filedir -d
2487+
_comp_compgen -a filedir -d
24852488
return
24862489
;;
24872490
*file* | *path*)
2488-
_filedir
2491+
_comp_compgen -a filedir
24892492
return
24902493
;;
24912494
esac
@@ -2502,10 +2505,10 @@ _comp_longopt()
25022505
done)"
25032506
[[ ${COMPREPLY-} == *= ]] && compopt -o nospace
25042507
elif [[ $1 == *@(rmdir|chroot) ]]; then
2505-
_filedir -d
2508+
_comp_compgen -a filedir -d
25062509
else
25072510
[[ $1 == *mkdir ]] && compopt -o nospace
2508-
_filedir
2511+
_comp_compgen -a filedir
25092512
fi
25102513
}
25112514
# makeinfo and texi2dvi are defined elsewhere.

completions/2to3

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ _comp_cmd_2to3()
1919
return
2020
;;
2121
-o | --output-dir)
22-
_filedir -d
22+
_comp_compgen -a filedir -d
2323
return
2424
;;
2525
esac
@@ -32,7 +32,7 @@ _comp_cmd_2to3()
3232
return
3333
fi
3434

35-
_filedir py
35+
_comp_compgen -a filedir py
3636
} &&
3737
complete -F _comp_cmd_2to3 2to3
3838

completions/7z

+3-3
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ _comp_cmd_7z()
109109
# - terminate on token containing anything [^a-z0-9]
110110
# (assumption: extensions are all lowercase)
111111
[[ $mode == w ]] &&
112-
_filedir '@(7z|bz2|swf|?(g)tar|?(t)[bglx]z|tb?(z)2|wim)' ||
113-
_filedir '@(7z?(.001)|arj|bz2|cab|cb7|chm|cpio|deb|dmg|flv|gem|img|iso|lz[ah]|lzma?(86)|msi|pmd|[rx]ar|rpm|sw[fm]|?(g)tar|taz|?(t)[bglx]z|tb?(z)2|vhd|wim|Z)'
112+
_comp_compgen -a filedir '@(7z|bz2|swf|?(g)tar|?(t)[bglx]z|tb?(z)2|wim)' ||
113+
_comp_compgen -a filedir '@(7z?(.001)|arj|bz2|cab|cb7|chm|cpio|deb|dmg|flv|gem|img|iso|lz[ah]|lzma?(86)|msi|pmd|[rx]ar|rpm|sw[fm]|?(g)tar|taz|?(t)[bglx]z|tb?(z)2|vhd|wim|Z)'
114114
else
115115
if [[ ${words[1]} == d ]]; then
116116
local IFS=$'\n'
@@ -119,7 +119,7 @@ _comp_cmd_7z()
119119
2>/dev/null | tail -n+2)")" -- "$cur"))
120120
compopt -o filenames
121121
else
122-
_filedir
122+
_comp_compgen -a filedir
123123
fi
124124
fi
125125
} &&

completions/_adb

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ _comp_cmd_adb()
2020
return
2121
;;
2222
-f)
23-
_filedir
23+
_comp_compgen -a filedir
2424
return
2525
;;
2626
esac
@@ -54,7 +54,7 @@ _comp_cmd_adb()
5454

5555
case $cmd in
5656
push | restore | sideload)
57-
_filedir
57+
_comp_compgen -a filedir
5858
;;
5959
forward)
6060
COMPREPLY=($(compgen -W \

completions/_chsh

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ _comp_cmd_chsh()
2222
return
2323
;;
2424
-R | --root)
25-
_filedir -d
25+
_comp_compgen -a filedir -d
2626
return
2727
;;
2828
-s | --shell)

completions/_hexdump

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ _comp_cmd_hexdump()
1313
return
1414
;;
1515
-f)
16-
_filedir
16+
_comp_compgen -a filedir
1717
return
1818
;;
1919
esac
@@ -25,7 +25,7 @@ _comp_cmd_hexdump()
2525
return
2626
fi
2727

28-
_filedir
28+
_comp_compgen -a filedir
2929
} &&
3030
complete -F _comp_cmd_hexdump hexdump hd
3131

completions/_hwclock

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ _comp_cmd_hwclock()
1313
return
1414
;;
1515
-f | --rtc | --adjfile)
16-
_filedir
16+
_comp_compgen -a filedir
1717
return
1818
;;
1919
esac

completions/_mock

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ _comp_cmd_mock()
3232
return
3333
;;
3434
--configdir | --resultdir)
35-
_filedir -d
35+
_comp_compgen -a filedir -d
3636
return
3737
;;
3838
--spec)
39-
_filedir spec
39+
_comp_compgen -a filedir spec
4040
return
4141
;;
4242
--target)
@@ -61,7 +61,7 @@ _comp_cmd_mock()
6161
COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur"))
6262
[[ ${COMPREPLY-} == *= ]] && compopt -o nospace
6363
else
64-
_filedir '@(?(no)src.r|s)pm'
64+
_comp_compgen -a filedir '@(?(no)src.r|s)pm'
6565
fi
6666
} &&
6767
complete -F _comp_cmd_mock mock

completions/_mount.linux

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ _comp_cmd_mount()
2828
return
2929
;;
3030
--bind | -B | --rbind | -R)
31-
_filedir -d
31+
_comp_compgen -a filedir -d
3232
return
3333
;;
3434
-p | --pass-fd)
@@ -245,7 +245,7 @@ _comp_cmd_mount()
245245
fi
246246
fi
247247

248-
_filedir
248+
_comp_compgen -a filedir
249249
} &&
250250
complete -F _comp_cmd_mount mount
251251

completions/_repomanage

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ _comp_cmd_repomanage()
1616
COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur"))
1717
[[ ${COMPREPLY-} == *= ]] && compopt -o nospace
1818
else
19-
_filedir -d
19+
_comp_compgen -a filedir -d
2020
fi
2121
} &&
2222
complete -F _comp_cmd_repomanage repomanage

completions/_slackpkg

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ _comp_cmd_slackpkg()
7474
return
7575
;;
7676
remove)
77-
_filedir
77+
_comp_compgen -a filedir
7878
COMPREPLY+=($(compgen -W 'a ap d e f k kde kdei l n t tcl x
7979
xap xfce y' -- "$cur"))
8080
COMPREPLY+=($(
@@ -84,7 +84,7 @@ _comp_cmd_slackpkg()
8484
return
8585
;;
8686
install | reinstall | upgrade | blacklist | download)
87-
_filedir
87+
_comp_compgen -a filedir
8888
COMPREPLY+=($(compgen -W 'a ap d e f k kde kdei l n t tcl x
8989
xap xfce y' -- "$cur"))
9090
COMPREPLY+=($(cut -f 6 -d\ "${WORKDIR}/pkglist" 2>/dev/null |

completions/_svn

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ _comp_cmd_svn()
2626

2727
case $prev in
2828
--config-dir)
29-
_filedir -d
29+
_comp_compgen -a filedir -d
3030
return
3131
;;
3232
-F | --file | --targets)
33-
_filedir
33+
_comp_compgen -a filedir
3434
return
3535
;;
3636
--encoding)
@@ -199,7 +199,7 @@ _comp_cmd_svn()
199199
if [[ $command == @(help|[h?]) ]]; then
200200
COMPREPLY=($(compgen -W "$commands" -- "$cur"))
201201
else
202-
_filedir
202+
_comp_compgen -a filedir
203203
fi
204204
fi
205205
fi

completions/_svnadmin

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ _comp_cmd_svnadmin()
2121
else
2222
case $prev in
2323
--config-dir)
24-
_filedir -d
24+
_comp_compgen -a filedir -d
2525
return
2626
;;
2727
--fs-type)
@@ -67,7 +67,7 @@ _comp_cmd_svnadmin()
6767
if [[ $command == @(help|[h?]) ]]; then
6868
COMPREPLY=($(compgen -W "$commands" -- "$cur"))
6969
else
70-
_filedir
70+
_comp_compgen -a filedir
7171
fi
7272
fi
7373
fi

completions/_svnlook

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ _comp_cmd_svnlook()
5252
if [[ $command == @(help|[h?]) ]]; then
5353
COMPREPLY=($(compgen -W "$commands" -- "$cur"))
5454
else
55-
_filedir
55+
_comp_compgen -a filedir
5656
fi
5757
fi
5858
fi

completions/_udevadm

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ _comp_cmd_udevadm()
3535
;;
3636
--name)
3737
: "${cur:=/dev/}"
38-
_filedir
38+
_comp_compgen -a filedir
3939
return
4040
;;
4141
--device-id-of-file | --exit-if-exists)
42-
_filedir
42+
_comp_compgen -a filedir
4343
return
4444
;;
4545
--action)

completions/_xm

+5-5
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ _comp_cmd_xm()
9898
esac
9999
;;
100100
restore | dry-run | vnet-create)
101-
_filedir
101+
_comp_compgen -a filedir
102102
;;
103103
save)
104104
_count_args
@@ -107,7 +107,7 @@ _comp_cmd_xm()
107107
_comp_cmd_xm__domain_names
108108
;;
109109
3)
110-
_filedir
110+
_comp_compgen -a filedir
111111
;;
112112
esac
113113
;;
@@ -186,19 +186,19 @@ _comp_cmd_xm()
186186
esac
187187
;;
188188
create)
189-
_filedir
189+
_comp_compgen -a filedir
190190
COMPREPLY+=(
191191
$(compgen -W '$(command ls /etc/xen 2>/dev/null)' \
192192
-- "$cur"))
193193
;;
194194
new)
195195
case $prev in
196196
-f | -F | --defconfig | --config)
197-
_filedir
197+
_comp_compgen -a filedir
198198
return
199199
;;
200200
--path)
201-
_filedir -d
201+
_comp_compgen -a filedir -d
202202
return
203203
;;
204204
esac

completions/_yum

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ _comp_cmd_yum()
5656
# TODO: install|update|upgrade should not match *src.rpm
5757
if [[ $cur == @(*/|[.~])* &&
5858
$special == @(deplist|install|update|upgrade) ]]; then
59-
_filedir rpm
59+
_comp_compgen -a filedir rpm
6060
return
6161
fi
6262
case $special in
@@ -94,16 +94,16 @@ _comp_cmd_yum()
9494
;;
9595
localinstall | localupdate)
9696
# TODO: should not match *src.rpm
97-
_filedir rpm
97+
_comp_compgen -a filedir rpm
9898
;;
9999
-d | -e)
100100
COMPREPLY=($(compgen -W '{0..10}' -- "$cur"))
101101
;;
102102
-c)
103-
_filedir
103+
_comp_compgen -a filedir
104104
;;
105105
--installroot)
106-
_filedir -d
106+
_comp_compgen -a filedir -d
107107
;;
108108
--enablerepo)
109109
COMPREPLY=($(compgen -W '$(_yum_repolist disabled)' -- "$cur"))

0 commit comments

Comments
 (0)