Move _cdk completion

This commit is contained in:
Marc Cornellà 2026-07-22 19:42:52 +02:00
commit 9627cc86c6
3 changed files with 18 additions and 20 deletions

View file

@ -1,11 +1,6 @@
# AWS CDK Plugin
This plugin provides aliases and autocompletion for the
[AWS Cloud Development Kit (CDK)](https://aws.amazon.com/cdk/) CLI.
## Requirements
- [AWS CDK CLI](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html) installed (`npm install -g aws-cdk`)
This plugin provides aliases and autocompletion for the [AWS Cloud Development Kit (CDK)](https://aws.amazon.com/cdk/) CLI.
## Usage
@ -15,6 +10,10 @@ Add `cdk` to the plugins array in your `.zshrc`:
plugins=(... cdk)
```
## Requirements
- [AWS CDK CLI](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html) installed (`npm install -g aws-cdk`)
## Aliases
| Alias | Command | Description |
@ -30,4 +29,4 @@ plugins=(... cdk)
| `cdkwatch` | `cdk watch` | Watch for changes and auto-deploy |
| `cdkctx` | `cdk context` | Manage cached context values |
| `cdkack` | `cdk acknowledge` | Acknowledge a notice |
| `cdkver` | `cdk --version` | Print CDK version |
| `cdkver` | `cdk --version` | Print CDK version |

12
plugins/cdk/_cdk Normal file
View file

@ -0,0 +1,12 @@
#compdef cdk
# Originally found and adapted from: https://github.com/aws/aws-cdk/discussions/24380#discussioncomment-5158176
local -a reply
local IFS
IFS=$'\n' reply=($(COMP_CWORD="$((CURRENT-1))" \
COMP_LINE="$BUFFER" \
COMP_POINT="$CURSOR" \
cdk --get-yargs-completions "${words[@]}"))
_describe 'values' reply

View file

@ -1,6 +1,3 @@
# AWS CDK plugin for Oh My Zsh
# Provides aliases and autocompletion for the AWS Cloud Development Kit (CDK) CLI
# Aliases
alias cdkl='cdk list'
alias cdksynth='cdk synth'
@ -14,13 +11,3 @@ alias cdkwatch='cdk watch'
alias cdkctx='cdk context'
alias cdkack='cdk acknowledge'
alias cdkver='cdk --version'
# Autocompletion
if command -v cdk &>/dev/null; then
_cdk_completion() {
local -a completions
completions=($(cdk completion 2>/dev/null))
compadd -a completions
}
compdef _cdk_completion cdk
fi