Skip to content

Commit ad80aa8

Browse files
akinomyogascop
andcommitted
refactor(mock,_{,u}mount.linux,kldunload): work around nounset
Co-authored-by: Ville Skyttä <[email protected]>
1 parent b6d06bc commit ad80aa8

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

completions/_mock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ _comp_cmd_mock()
2727
return
2828
;;
2929
-r | --root)
30-
_comp_compgen_split -- "$(command ls "$cfgdir")"
31-
COMPREPLY=(${COMPREPLY[@]/%.cfg/})
30+
_comp_compgen_split -- "$(command ls "$cfgdir")" &&
31+
COMPREPLY=(${COMPREPLY[@]/%.cfg/})
3232
return
3333
;;
3434
--configdir | --resultdir)

completions/_mount.linux

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ _comp_cmd_mount()
2424
qnx4 ramfs reiserfs romfs squashfs smbfs sysv tmpfs ubifs udf
2525
ufs umsdos usbfs vfat xfs'
2626
_comp_compgen -a fstypes
27-
[[ $split ]] && COMPREPLY=(${COMPREPLY[@]/#/$prev,})
27+
[[ $split ]] && ((${#COMPREPLY[@]})) &&
28+
COMPREPLY=(${COMPREPLY[@]/#/$prev,})
2829
return
2930
;;
3031
--bind | -B | --rbind | -R)
@@ -202,7 +203,8 @@ _comp_cmd_mount()
202203
esac
203204
# COMP_WORDBREAKS is a real pain in the ass
204205
prev="${prev##*["$COMP_WORDBREAKS"]}"
205-
[[ $split ]] && COMPREPLY=(${COMPREPLY[@]/#/"$prev,"})
206+
[[ $split ]] && ((${COMPREPLY[@]})) &&
207+
COMPREPLY=(${COMPREPLY[@]/#/"$prev,"})
206208
[[ ${COMPREPLY-} == *= ]] && compopt -o nospace
207209
return
208210
;;

completions/_umount.linux

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ _comp_cmd_umount()
110110
reiserfs romfs squashfs smbfs sysv tmpfs ubifs udf ufs umsdos
111111
usbfs vfat xfs'
112112
_comp_compgen -a fstypes
113-
[[ $split ]] && COMPREPLY=(${COMPREPLY[@]/#/$prev,})
113+
[[ $split ]] && ((${#COMPREPLY[@]})) &&
114+
COMPREPLY=(${COMPREPLY[@]/#/$prev,})
114115
return
115116
;;
116117
-O)

completions/kldunload

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ _comp_cmd_kldunload()
77
local cur prev words cword comp_args
88
_comp_initialize -- "$@" || return
99

10-
_comp_compgen_split -X '!*.ko' -- "$(kldstat)"
11-
COMPREPLY=(${COMPREPLY[@]%.ko})
10+
_comp_compgen_split -X '!*.ko' -- "$(kldstat)" &&
11+
COMPREPLY=(${COMPREPLY[@]%.ko})
1212
} &&
1313
complete -F _comp_cmd_kldunload kldunload
1414

0 commit comments

Comments
 (0)