mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-22 04:51:12 +02:00
Add an Oh My Zsh plugin for AWS CDK that registers yargs-based zsh completions and falls back to an npx wrapper for project-local CDK installations.
22 lines
562 B
Bash
22 lines
562 B
Bash
# AWS CDK plugin
|
|
#
|
|
# Adds completion for the AWS CDK CLI. If `cdk` is not installed globally but
|
|
# `npx` is available, define a wrapper so project-local CDK installations work.
|
|
|
|
if (( ! $+commands[cdk] )); then
|
|
if (( ! $+commands[npx] )); then
|
|
return
|
|
fi
|
|
|
|
function cdk() {
|
|
npx -- cdk "$@"
|
|
}
|
|
fi
|
|
|
|
function _cdk_yargs_completions() {
|
|
local -a reply
|
|
reply=(${(f)"$(COMP_CWORD="$((CURRENT - 1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" cdk --get-yargs-completions "${words[@]}")"})
|
|
_describe 'values' reply
|
|
}
|
|
|
|
compdef _cdk_yargs_completions cdk
|