add bash completion

This commit is contained in:
Leon Henrik Plickat
2024-03-28 19:11:46 +01:00
parent dffcf3d8fc
commit 54230d76e6
2 changed files with 17 additions and 1 deletions

14
bash-completion Normal file
View File

@ -0,0 +1,14 @@
function __wlopm_completion ()
{
case "${COMP_WORDS[-2]}" in
"--on"|"--off"|"--toggle")
OPTS="$(wlopm | cut -d' ' -f1 | tr '\n' ' ')"
;;
*)
OPTS="-h --help -j --json -v --version --on --off --toggle"
;;
esac
COMPREPLY=($(compgen -W "${OPTS}" -- "${COMP_WORDS[${COMP_CWORD}]}"))
}
complete -F __wlopm_completion wlopm