Sample Header Ad - 728x90

zsh completion for umount: limit completion to one argument

1 vote
1 answer
51 views
when I use zsh completion for the umount command: umount /mnt/t it completes the mounted filesystem /mnt/tmp. But when I accidentally press tab too many times, it tries to be too helpful, and suggests other mountpoints, which leads to nonsense completions such as: umount /mnt/tmp / how can I limit umount completion to one mountpoint only, so that further tabs will not add any further arguments? I think I have located the relevant section in /usr/share/zsh/functions/Completion/Unix/_mount: # Completion for umount. local excl='-V --version -h --help' args=( '(- *)'{-h,--help}'[show help]' '(- *)'{-V,--version}'[show version]' "($excl -v --verbose)"{-v,--verbose}'[verbose mode]' "($excl -n --no-mtab)"{-n,--no-mtab}"[don't write /etc/mtab]" "($excl)-r[remount read-only on failure]" "($excl)-d[for loopback mount, free loop device]" "($excl)-i[don't call /sbin/umount. helper]" "($excl *)-a[unmount all file systems from /etc/mtab]" "($excl)-t[specify file system type]:file system type:_file_systems" "($excl *)-O[with -a, restrict filesystems by options]:file system option:->fsopt" "($excl)-f[force unmount]" "($excl)-l[lazy unmount]" '*:dev or dir:->udevordir' ) _arguments -C -s "$args[@]" && ret=0 what do I need to modify?
Asked by Martin Vegter (586 rep)
Mar 7, 2024, 03:39 PM
Last activity: Mar 7, 2024, 05:48 PM