Skip to content

Commit 7054a3c

Browse files
committed
refactor: use _comp_compgen_filedir
1 parent 6e8a154 commit 7054a3c

File tree

326 files changed

+790
-787
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

+790
-787
lines changed

bash_completion

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ _comp_variable_assignments()
10161016
case $prev in
10171017
TZ)
10181018
cur=/usr/share/zoneinfo/$cur
1019-
_filedir
1019+
_comp_compgen -a filedir
10201020
if ((${#COMPREPLY[@]})); then
10211021
for i in "${!COMPREPLY[@]}"; do
10221022
if [[ ${COMPREPLY[i]} == *.tab ]]; then
@@ -1041,7 +1041,7 @@ _comp_variable_assignments()
10411041
;;
10421042
*)
10431043
_variables && return 0
1044-
_filedir
1044+
_comp_compgen -a filedir
10451045
;;
10461046
esac
10471047

@@ -1056,9 +1056,12 @@ _comp_variable_assignments()
10561056
#
10571057
# Options:
10581058
# -n EXCLUDE Passed to _comp_get_words -n with redirection chars
1059-
# -e XSPEC Passed to _filedir as first arg for stderr redirections
1060-
# -o XSPEC Passed to _filedir as first arg for other output redirections
1061-
# -i XSPEC Passed to _filedir as first arg for stdin redirections
1059+
# -e XSPEC Passed to _comp_compgen_filedir as first arg for stderr
1060+
# redirections
1061+
# -o XSPEC Passed to _comp_compgen_filedir as first arg for other output
1062+
# redirections
1063+
# -i XSPEC Passed to _comp_compgen_filedir as first arg for stdin
1064+
# redirections
10621065
# -s Split long options with _comp__split_longopt, implies -n =
10631066
# @param $1...$3 args Original arguments specified to the completion function.
10641067
# The first argument $1 is command name. The second
@@ -1069,9 +1072,9 @@ _comp_variable_assignments()
10691072
# @var[out] prev Reconstructed previous word
10701073
# @var[out] words Reconstructed words
10711074
# @var[out] cword Current word index in `words`
1072-
# @var[out] comp_args Original arguments specified to the completion function
1073-
# are saved in this array, if the arguments $1...$3 is
1074-
# specified.
1075+
# @var[out] comp_args Original arguments specified to the completion
1076+
# function are saved in this array, if the arguments
1077+
# $1...$3 is specified.
10751078
# @var[out,opt] was_split When "-s" is specified, `"set"/""` is set depending
10761079
# on whether the split happened.
10771080
# @return True (0) if completion needs further processing,
@@ -1127,7 +1130,7 @@ _comp_initialize()
11271130
;;
11281131
esac
11291132
cur=${cur##"$redir"}
1130-
_filedir "$xspec"
1133+
_comp_compgen -a filedir "$xspec"
11311134
return 1
11321135
fi
11331136

@@ -2473,23 +2476,23 @@ _comp_longopt()
24732476
return
24742477
;;
24752478
--!(no-*)dir*)
2476-
_filedir -d
2479+
_comp_compgen -a filedir -d
24772480
return
24782481
;;
24792482
--!(no-*)@(file|path)*)
2480-
_filedir
2483+
_comp_compgen -a filedir
24812484
return
24822485
;;
24832486
--+([-a-z0-9_]))
24842487
local argtype=$(LC_ALL=C $1 --help 2>&1 | command sed -ne \
24852488
"s|.*$prev\[\{0,1\}=[<[]\{0,1\}\([-A-Za-z0-9_]\{1,\}\).*|\1|p")
24862489
case ${argtype,,} in
24872490
*dir*)
2488-
_filedir -d
2491+
_comp_compgen -a filedir -d
24892492
return
24902493
;;
24912494
*file* | *path*)
2492-
_filedir
2495+
_comp_compgen -a filedir
24932496
return
24942497
;;
24952498
esac
@@ -2506,10 +2509,10 @@ _comp_longopt()
25062509
done)"
25072510
[[ ${COMPREPLY-} == *= ]] && compopt -o nospace
25082511
elif [[ $1 == *@(rmdir|chroot) ]]; then
2509-
_filedir -d
2512+
_comp_compgen -a filedir -d
25102513
else
25112514
[[ $1 == *mkdir ]] && compopt -o nospace
2512-
_filedir
2515+
_comp_compgen -a filedir
25132516
fi
25142517
}
25152518
# makeinfo and texi2dvi are defined elsewhere.

completions/2to3

Lines changed: 2 additions & 2 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

0 commit comments

Comments
 (0)