da368d646833c61f73ed30ebb664c6d0e6c4fe73
- Author
- Akshat1927 <kardakakshat@gmail.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
feat(cdk): add plugin (#13831)
Co-authored-by: Marc Cornellà <marc@mcornella.com>
Diff
1diff --git a/plugins/cdk/README.md b/plugins/cdk/README.md
2new file mode 100644
3index 0000000000000000000000000000000000000000..fe97ba4ea8f4d76614001bdeb61404cf62a79326
4--- /dev/null
5+++ b/plugins/cdk/README.md
6@@ -0,0 +1,32 @@
7+# AWS CDK Plugin
8+
9+This plugin provides aliases and autocompletion for the [AWS Cloud Development Kit (CDK)](https://aws.amazon.com/cdk/) CLI.
10+
11+## Usage
12+
13+Add `cdk` to the plugins array in your `.zshrc`:
14+
15+```zsh
16+plugins=(... cdk)
17+```
18+
19+## Requirements
20+
21+- [AWS CDK CLI](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html) installed (`npm install -g aws-cdk`)
22+
23+## Aliases
24+
25+| Alias | Command | Description |
26+| ------------ | ----------------- | ---------------------------------- |
27+| `cdkl` | `cdk list` | List all stacks in the app |
28+| `cdksynth` | `cdk synth` | Synthesize CloudFormation template |
29+| `cdkdiff` | `cdk diff` | Compare deployed vs local stack |
30+| `cdkdeploy` | `cdk deploy` | Deploy stack to AWS |
31+| `cdkdestroy` | `cdk destroy` | Destroy deployed stack |
32+| `cdkboot` | `cdk bootstrap` | Bootstrap CDK environment |
33+| `cdkdoc` | `cdk docs` | Open CDK documentation |
34+| `cdkinit` | `cdk init` | Initialize a new CDK project |
35+| `cdkwatch` | `cdk watch` | Watch for changes and auto-deploy |
36+| `cdkctx` | `cdk context` | Manage cached context values |
37+| `cdkack` | `cdk acknowledge` | Acknowledge a notice |
38+| `cdkver` | `cdk --version` | Print CDK version |
39diff --git a/plugins/cdk/_cdk b/plugins/cdk/_cdk
40new file mode 100644
41index 0000000000000000000000000000000000000000..4a67095c0299194494cf9365dfb2c4c0f4109970
42--- /dev/null
43+++ b/plugins/cdk/_cdk
44@@ -0,0 +1,12 @@
45+#compdef cdk
46+
47+# Originally found and adapted from: https://github.com/aws/aws-cdk/discussions/24380#discussioncomment-5158176
48+
49+local -a reply
50+local IFS
51+IFS=$'\n' reply=($(COMP_CWORD="$((CURRENT-1))" \
52+ COMP_LINE="$BUFFER" \
53+ COMP_POINT="$CURSOR" \
54+ cdk --get-yargs-completions "${words[@]}"))
55+
56+_describe 'values' reply
57diff --git a/plugins/cdk/cdk.plugin.zsh b/plugins/cdk/cdk.plugin.zsh
58new file mode 100644
59index 0000000000000000000000000000000000000000..654d372fa95b751b2dbc6af4a9617e27cf567cff
60--- /dev/null
61+++ b/plugins/cdk/cdk.plugin.zsh
62@@ -0,0 +1,13 @@
63+# Aliases
64+alias cdkl='cdk list'
65+alias cdksynth='cdk synth'
66+alias cdkdiff='cdk diff'
67+alias cdkdeploy='cdk deploy'
68+alias cdkdestroy='cdk destroy'
69+alias cdkboot='cdk bootstrap'
70+alias cdkdoc='cdk docs'
71+alias cdkinit='cdk init'
72+alias cdkwatch='cdk watch'
73+alias cdkctx='cdk context'
74+alias cdkack='cdk acknowledge'
75+alias cdkver='cdk --version'