Last active
June 13, 2024 15:22
-
-
Save kirtfitzpatrick/e7a7828e99bae609955f08b35fc2c8b1 to your computer and use it in GitHub Desktop.
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
function _cdk_completer { | |
STACK_CMDS="list synthesize bootstrap deploy destroy diff metadata init context docs doctor" | |
if [ "$3" == "cdk" ]; then | |
COMPREPLY=($(compgen -W "$STACK_CMDS" $2)) | |
elif [[ -d "cdk.out" ]] && ! [[ "$2" == "-"* ]]; then | |
TEMPLATES=$(ls -1 cdk.out/*.template.json | awk '{split($0,t,/\/|\./); print t[3]}') | |
COMPREPLY=($(compgen -W "$TEMPLATES" $2)) | |
else | |
COMPREPLY=() | |
fi | |
} | |
complete -F _cdk_completer cdk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for sharing this snippet. Definitely comes in handy 👍