future-install-scripts/completion/zsh/_genfstab
Emil Velikov 86088c21b1 zsh: split completion into separate files
The current file is borderline impossible to manage by zsh completion
noobies. Split it up for now, where follow-up commits will simplify
things.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-03-26 17:13:06 +01:00

52 lines
1.2 KiB
Plaintext

#compdef genfstab
_genfstab_args=(
'-h[display help]'
)
_genfstab_args_nonh=(
'(--help -h)-p[Avoid printing pseudofs mounts]'
'(-U --help -h)-L[Use labels for source identifiers]'
'(-L --help -h)-U[Use UUIDs for source identifiers]'
)
_longopts=( '--help[display help]' )
_genfstab(){
if [[ -z ${(M)words:#--help} && -z ${(M)words:#-*h} ]]; then
case $words[CURRENT] in
-p*|-L*|-U*)
_arguments -s : \
"$_genfstab_args_nonh[@]"
;;
-*)
_arguments -s : \
"$_genfstab_args[@]" \
"$_genfstab_args_nonh[@]" \
"$_longopts[@]"
;;
--*)
_arguments -s : \
"$_longopts[@]"
;;
*)
_arguments \
"$_genfstab_args[@]" \
"$_genfstab_args_nonh[@]" \
"$_longopts[@]" \
":*:_path_files -/"
;;
esac
else
return 1
fi
}
_install_scripts(){
case "$service" in
genfstab)
_genfstab "$@";;
esac
}
_install_scripts "$@"