Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
xCAT completions
_xcat_complete() {
COMPREPLY=()
if [[ "${COMP_LINE}" =~ ^(ls|rm|ch|mk)def ]] || [[ "$COMP_LINE" =~ ^nodeset ]]; then
if [[ "${COMP_LINE}" =~ "-t network" ]]; then
local networks=$(lsdef -t network | cut -f1 -d' ' | paste -sd ' ')
COMPREPLY=( $(compgen -W "$networks" -- ${COMP_WORDS[-1]}) )
return 0
elif [[ "${COMP_LINE}" =~ "-t osimage" ]] || [[ "$COMP_LINE" =~ "osimage=" ]]; then
COMPREPLY=( $(compgen -W "$(lsdef -t osimage | cut -f1 -d' ' | paste -sd ' ')" -- ${COMP_WORDS[-1]#*=}) )
return 0
fi
fi
}
complete -F _xcat_complete {ls,mk,ch,rm}def nodeset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.