mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-22 04:51:12 +02:00
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:
parent
e64912e0c1
commit
368728a512
2 changed files with 37 additions and 0 deletions
15
plugins/cdk/README.md
Normal file
15
plugins/cdk/README.md
Normal 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.
|
||||
22
plugins/cdk/cdk.plugin.zsh
Normal file
22
plugins/cdk/cdk.plugin.zsh
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue