Add AWS CDK plugin

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.
This commit is contained in:
aayu22809 2026-05-04 02:02:26 -07:00
commit 368728a512
2 changed files with 37 additions and 0 deletions

15
plugins/cdk/README.md Normal file
View file

@ -0,0 +1,15 @@
# AWS CDK plugin
This plugin adds completion for the [AWS Cloud Development Kit (CDK)](https://aws.amazon.com/cdk/) CLI.
To use it, add `cdk` to the plugins array in your zshrc file:
```zsh
plugins=(... cdk)
```
If the `cdk` command is installed globally, the plugin uses it directly. If `cdk` is not found but `npx` is
available, the plugin defines a `cdk` wrapper that runs `npx -- cdk`, which supports project-local CDK
installations.
This plugin does not add any aliases.

View file

@ -0,0 +1,22 @@
# 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