Skip to content

Commit 4a4851c

Browse files
committed
refactor: use _comp_compgen -c for filedir
1 parent 2498588 commit 4a4851c

28 files changed

+41
-77
lines changed

completions/_udevadm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ _comp_cmd_udevadm()
3434
return
3535
;;
3636
--name)
37-
: "${cur:=/dev/}"
38-
_comp_compgen filedir
37+
_comp_compgen -c "${cur:-/dev/}" filedir
3938
return
4039
;;
4140
--device-id-of-file | --exit-if-exists)

completions/badblocks

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ _comp_cmd_badblocks()
2121
return
2222
fi
2323

24-
: "${cur:=/dev/}"
25-
_comp_compgen filedir
24+
_comp_compgen -c "${cur:-/dev/}" filedir
2625
} &&
2726
complete -F _comp_cmd_badblocks badblocks
2827

completions/cryptsetup

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ _comp_cmd_cryptsetup__name()
77

88
_comp_cmd_cryptsetup__device()
99
{
10-
: "${cur:=/dev/}"
11-
_comp_compgen filedir
10+
_comp_compgen -c "${cur:-/dev/}" filedir
1211
}
1312

1413
_comp_cmd_cryptsetup()

completions/curl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ _comp_cmd_curl()
5353
--data | --data-ascii | --data-binary | --data-urlencode | --header | \
5454
--proxy-header | -${noargopts}[dH])
5555
if [[ $cur == \@* ]]; then
56-
cur=${cur:1}
57-
_comp_compgen filedir
56+
_comp_compgen -c "${cur:1}" filedir
5857
if [[ ${#COMPREPLY[@]} -eq 1 && -d ${COMPREPLY[0]} ]]; then
5958
COMPREPLY[0]+=/
6059
compopt -o nospace

completions/dd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ _comp_cmd_dd()
77

88
case $cur in
99
if=* | of=*)
10-
cur=${cur#*=}
11-
_comp_compgen filedir
10+
_comp_compgen -c "${cur#*=}" filedir
1211
return
1312
;;
1413
conv=*)

completions/dnssec-keygen

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ _comp_cmd_dnssec_keygen()
2727
return
2828
;;
2929
-r)
30-
: "${cur:=/dev/}"
31-
_comp_compgen filedir
30+
_comp_compgen -c "${cur:-/dev/}" filedir
3231
return
3332
;;
3433
-v)

completions/dot

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ _comp_cmd_dot()
2626
return
2727
;;
2828
-o*)
29-
cur=${cur#-o}
30-
_comp_compgen filedir
31-
((${#COMPREPLY[@]})) &&
32-
COMPREPLY=($(compgen -P -o -W '"${COMPREPLY[@]}"' -- "$cur"))
29+
_comp_compgen -c "${cur#-o}" filedir
30+
((${#COMPREPLY[@]})) && COMPREPLY=("${COMPREPLY[@]/#/-o}")
3331
return
3432
;;
3533
esac

completions/dumpe2fs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ _comp_cmd_dumpe2fs()
2020
return
2121
fi
2222

23-
: "${cur:=/dev/}"
24-
_comp_compgen filedir
23+
_comp_compgen -c "${cur:-/dev/}" filedir
2524
} &&
2625
complete -F _comp_cmd_dumpe2fs dumpe2fs
2726

completions/e2freefrag

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ _comp_cmd_e2freefrag()
1616
return
1717
fi
1818

19-
: "${cur:=/dev/}"
20-
_comp_compgen filedir
19+
_comp_compgen -c "${cur:-/dev/}" filedir
2120
} &&
2221
complete -F _comp_cmd_e2freefrag e2freefrag
2322

completions/e2label

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ _comp_cmd_e2label()
66
_comp_initialize -- "$@" || return
77

88
if ((cword == 1)); then
9-
: "${cur:=/dev/}"
10-
_comp_compgen filedir
9+
_comp_compgen -c "${cur:-/dev/}" filedir
1110
fi
1211
} &&
1312
complete -F _comp_cmd_e2label e2label

0 commit comments

Comments
 (0)