Created
November 8, 2019 15:01
-
-
Save dhilst/308b4b26599b13c20a8ff46603b0fc27 to your computer and use it in GitHub Desktop.
xCAT completions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_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