1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2026-01-10 11:01:32 +01:00
zsh/Completion/Linux/Command/_fusermount
Norbert Lange c1f1bbc5b9 github #93: Replace /etc/mtab with /proc/self/mounts for Linux
/proc/self/mounts has been available since Linux 2.4.19,
released in 2002. /etc/mtab is usually a symlink to this
file but might not exist
2022-05-25 22:50:48 -05:00

26 lines
666 B
Text

#compdef fusermount
local expl context state line
typeset -A opt_args
_arguments \
'-h[display help information]' \
'-V[display version information]' \
'-o[specify mount options]:mount option:_fuse_values "mount option"' \
'-u[unmount a fuse mount]' \
'-z[unmount lazily (work even when if the resource is still busy)]' \
'-q[suppress nonessential output]' \
':mount point:->mountpoint' && return 0
typeset -a mtpts
case "$state" in
(mountpoint)
if [[ $+opt_args[-u] -eq 0 ]]; then
_files -/
else
mtpts=(${${${"${(f)$(< /proc/self/mounts)}"}#* }%% *})
_canonical_paths mounted 'mounted filesystem' "${(@g::)mtpts}"
fi
;;
esac