Skip to content

Commit 4e51a79

Browse files
committed
refactor(strings,tshark,tune2fs): use _comp_compgen -c for filedir
1 parent 2d12cbe commit 4e51a79

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

completions/strings

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ _comp_cmd_strings()
4747
[[ ${COMPREPLY-} == *= ]] && compopt -o nospace
4848
return
4949
elif [[ $cur == @* ]]; then
50-
cur=${cur:1}
51-
_comp_compgen_filedir
50+
_comp_compgen -c "${cur:1}" filedir
5251
COMPREPLY=("${COMPREPLY[@]/#/@}")
5352
return
5453
fi

completions/tshark

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ _comp_cmd_tshark()
2020
;;
2121
-o*)
2222
if [[ $cur == *:* ]]; then
23-
cur=${cur#*:}
24-
_comp_compgen_filedir
23+
_comp_compgen -c "${cur#*:}" filedir
2524
else
2625
[[ -v _comp_cmd_tshark__prefs ]] ||
2726
_comp_cmd_tshark__prefs="$("$1" -G defaultprefs 2>/dev/null | command sed -ne 's/^#\{0,1\}\([a-z0-9_.-]\{1,\}:\).*/\1/p' |
@@ -104,8 +103,7 @@ _comp_cmd_tshark()
104103
;;
105104
-*X)
106105
if [[ ${cur:${#prefix}} == lua_script:* ]]; then
107-
cur=${cur#*:}
108-
_comp_compgen_filedir lua
106+
_comp_compgen -c "${cur#*:}" filedir lua
109107
else
110108
COMPREPLY=($(compgen -P "$prefix" -W 'lua_script:' -- \
111109
"${cur:${#prefix}}"))

completions/tune2fs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ _comp_cmd_tune2fs()
5555
return
5656
fi
5757

58-
: "${cur:=/dev/}"
59-
_comp_compgen_filedir
58+
_comp_compgen -c "${cur:-/dev/}" filedir
6059
} &&
6160
complete -F _comp_cmd_tune2fs tune2fs
6261

0 commit comments

Comments
 (0)