Skip to content

Commit ff9e1d3

Browse files
authored
Merge pull request #1297 from akinomyoga/compgen-cwd
fix(_umount,feh,sbopkg): check diretory name for `_comp_compgen -C`
2 parents 5ed9384 + c2c6c08 commit ff9e1d3

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

completions/_umount.linux

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ _comp_cmd_umount__linux_fstab()
7272
realcur="$(readlink -f "$cur." 2>/dev/null)/" ||
7373
realcur=$(readlink -f "$cur" 2>/dev/null)
7474
if [[ $realcur ]]; then
75-
local dirrealcur="" dircur="" basecur
75+
local dirrealcur="" dircur=. basecur
7676
if [[ $cur == */* ]]; then
7777
dirrealcur="${realcur%/*}/"
7878
dircur="${cur%/*}/"

completions/feh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ _comp_cmd_feh()
3030
local font_path
3131
# font_path="$(imlib2-config --prefix 2>/dev/null)/share/imlib2/data/fonts"
3232
# _comp_compgen -C "$font_path" -- -f -X "!*.@([tT][tT][fF])" -S /
33-
for ((i = ${#words[@]} - 1; i > 0; i--)); do
33+
for ((i = ${#words[@]} - 2; i > 0; i--)); do
3434
if [[ ${words[i]} == -@(C|-fontpath) ]]; then
3535
font_path="${words[i + 1]}"
36-
_comp_compgen -aC "$font_path" -- \
37-
-f -X "!*.@([tT][tT][fF])" -S /
36+
if [[ -d $font_path ]]; then
37+
_comp_compgen -aC "$font_path" -- \
38+
-f -X "!*.@([tT][tT][fF])" -S /
39+
fi
3840
fi
3941
done
4042
compopt -o nospace

completions/sbopkg

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ _comp_cmd_sbopkg()
6363

6464
_comp_compgen_split -l -- "$(command sed -ne "s/^SLACKBUILD NAME: //p" \
6565
"$file")"
66-
_comp_compgen -aC "$QUEUEDIR" -- -f -X "!*.sqf"
66+
if [[ -d ${QUEUEDIR-} ]]; then
67+
_comp_compgen -aC "$QUEUEDIR" -- -f -X "!*.sqf"
68+
fi
6769
} &&
6870
complete -F _comp_cmd_sbopkg sbopkg
6971

0 commit comments

Comments
 (0)