#/usr/bin/env bash _hopon_completions () { # Check to see if a container/VM manager is installed. local vm_manager="" if [ -x "$(command -v lxc)" ]; then vm_manager="lxc" elif [ -x "$(command -v incus)" ]; then vm_manager="incus" else return fi # We only want one copy of the found parameter. if [ "${#COMP_WORDS[@]}" != "2" ]; then return fi COMPREPLY=($(compgen -W "$($vm_manager list -c n -f csv)" -- "${COMP_WORDS[1]}")) } complete -F _hopon_completions hopon