Add new plugin for the spryker sdk

This commit is contained in:
Timmo Schulte 2022-06-10 14:13:01 +02:00
parent d41ca84af1
commit f90cbc2de9
2 changed files with 71 additions and 0 deletions

24
plugins/spryker/README.md Normal file
View file

@ -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 |

View file

@ -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'