From c7295796f3857b41ab39a0d3d4508b1663c14ea6 Mon Sep 17 00:00:00 2001 From: Skyf0l <59019720+skyf0l@users.noreply.github.com> Date: Thu, 10 Jul 2025 15:57:43 +0200 Subject: [PATCH] feat: exegol aliases --- plugins/exegol/README.md | 30 +++++++++++++++++ plugins/exegol/exegol.plugin.zsh | 55 ++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 plugins/exegol/README.md create mode 100644 plugins/exegol/exegol.plugin.zsh diff --git a/plugins/exegol/README.md b/plugins/exegol/README.md new file mode 100644 index 000000000..9fea31c44 --- /dev/null +++ b/plugins/exegol/README.md @@ -0,0 +1,30 @@ +# Exegol plugin + +The Exegol plugin provides useful aliases + +To use it, add `exegol` to the plugins array of your zshrc file: + +```zsh +plugins=(... exegol) +``` + +## Aliases + +| Alias | Command | Description | +| :------ | :------------------------------- | :-------------------------------------------------------- | +| `e` | `exegol` | Shorthand for exegol command | +| `ei` | `exegol info` | Displays exegol information | +| `eu` | `exegol update` | Updates exegol to the latest version | +| `es` | `exegol start` | Starts an Exegol instance | +| `esn` | `exegol start [default] nightly` | Starts a nightly Exegol instance | +| `esf` | `exegol start [default] full` | Starts a full Exegol instance | +| `esf!` | `esf --privileged` | Starts a full Exegol instance with privileged access | +| `esn!` | `esn --privileged` | Starts a nightly Exegol instance with privileged access | +| `etmpn` | `exegol exec --tmp nightly` | Executes a command in a temporary nightly Exegol instance | +| `etmpf` | `exegol exec --tmp full` | Executes a command in a temporary full Exegol instance | +| `estp` | `exegol stop` | Stops an Exegol instance | +| `estpa` | `exegol stop --all` | Stops all Exegol instances | +| `erm` | `exegol remove` | Removes an Exegol instance | +| `erm!` | `exegol remove --force` | Removes an Exegol instance forcefully | +| `erma` | `exegol remove --all` | Removes all Exegol instances | +| `erma!` | `exegol remove --force --all` | Removes all Exegol instances forcefully | diff --git a/plugins/exegol/exegol.plugin.zsh b/plugins/exegol/exegol.plugin.zsh new file mode 100644 index 000000000..81ca94bb1 --- /dev/null +++ b/plugins/exegol/exegol.plugin.zsh @@ -0,0 +1,55 @@ +# Return immediately if exegol is not found +if (( ! ${+commands[exegol]} )); then + echo OK +fi + +alias e='exegol' +alias ei='exegol info' +alias eu='exegol update' + +alias es='exegol start' +function esn() { + local only_dashes=true + for arg in "$@"; do + if [[ ! "$arg" == -* ]]; then + only_dashes=false + break + fi + done + + if [[ "$#" == 0 ]] || $only_dashes; then + # If all arguments are dashes or empty, use default name + exegol start default nightly "$@" + else + exegol start "$@" nightly + fi +} +function esf() { + local only_dashes=true + for arg in "$@"; do + if [[ ! "$arg" == -* ]]; then + only_dashes=false + break + fi + done + + if [[ "$#" == 0 ]] || $only_dashes; then + # If all arguments are dashes or empty, use default name + exegol start default full "$@" + else + exegol start "$@" full + fi +} +alias esf!='esf --privileged' +alias esn!='esn --privileged' + +alias etmpn='exegol exec --tmp nightly' +alias etmpf='exegol exec --tmp full' + +alias estp='exegol stop' +alias estpa='exegol stop --all' + +alias erm='exegol remove' +alias erm!='exegol remove --force' +alias erma='exegol remove --all' +alias erma!='exegol remove --force --all'