From f90cbc2de9dc0b8e15fda4a4d8d216c4b82b5b9a Mon Sep 17 00:00:00 2001 From: Timmo Schulte Date: Fri, 10 Jun 2022 14:13:01 +0200 Subject: [PATCH] Add new plugin for the spryker sdk --- plugins/spryker/README.md | 24 +++++++++++++++ plugins/spryker/spryker.plugin.zsh | 47 ++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 plugins/spryker/README.md create mode 100644 plugins/spryker/spryker.plugin.zsh diff --git a/plugins/spryker/README.md b/plugins/spryker/README.md new file mode 100644 index 000000000..8aee575c7 --- /dev/null +++ b/plugins/spryker/README.md @@ -0,0 +1,24 @@ +# Spryker + +This plugin provides aliases for the most frequently used [Spryker SDK](https://github.com/spryker-sdk) commands, +as well as code completion for the commands `console` and `boot`. + +To use it add spryker to the plugins array in your zshrc file. + +```bash +plugins=(... spryker) +``` + +## Aliases + +| Alias | Command | Description | +|-----------|--------------------------------|-----------------------------------------| +| `spk` | docker/sdk | Runs the Spryker SDK | +| `spkc` | spk console | Runs a Spryker console command | +| `spkb` | spk boot -v | Bootstrap spryker with a deploy file | +| `spkt` | spk testing | Starts a testing container | +| `spku` | spk up | Builds and runs Spryker applications | +| `spkup` | spk up --build --assets --data | Same as up + build, assets and data | +| `spkcli` | spk cli | Starts a terminal container | +| `spkcc` | spk clean && spk clean-data | Removes all images, volumes and storage | +| `spkl` | spk logs | Tails all application exception logs | diff --git a/plugins/spryker/spryker.plugin.zsh b/plugins/spryker/spryker.plugin.zsh new file mode 100644 index 000000000..a5919af16 --- /dev/null +++ b/plugins/spryker/spryker.plugin.zsh @@ -0,0 +1,47 @@ +# Spryker SDK command completion + +_spryker() { + echo "$(find . -maxdepth 2 -mindepth 1 -name 'sdk' -type f 2>/dev/null | head -n 1)" +} + +_spryker_sdk () { + echo "$(_spryker)" +} + +_spryker_sdk_boot () { + echo "$(_spryker) boot -v" +} + +_spryker_sdk_console () { + echo "$(_spryker) console" +} + +_spk_console () { + compadd $(`_spryker_sdk_console` --no-ansi 2>/dev/null | sed "1,/Available commands/d" | awk '/^ ?[^ ]+ / { print $1 }') +} + +_spk_boot () { + compadd ls deploy.*.yml +} + +_spk () { + compadd $(`_spryker_sdk` 2>/dev/null | sed "1,/Commands:/d" | awk '/^ ?[^ ]+ / { print $1 }') +} + +compdef _spk_console '`_spryker_sdk_console`' +compdef _spk_console spkc +compdef _spk_boot '`_spryker_sdk_boot`' +compdef _spk_boot spkb +compdef _spk '`_spryker_sdk`' +compdef _spk spk + +#Alias +alias spk='`_spryker_sdk`' +alias spkc='`_spryker_sdk_console`' +alias spkb='`_spryker_sdk_boot`' +alias spkt='spk testing' +alias spku='spk up' +alias spkup='spk up --build --assets --data' +alias spkcli='spk cli' +alias spkcc='spk clean && spk clean-data' +alias spkl='spk logs'