docs and fix

This commit is contained in:
Carlo Sala 2024-08-02 16:35:20 +02:00
commit 3b06464e36
No known key found for this signature in database
GPG key ID: DA6FB450C1A4FE9A
2 changed files with 9 additions and 7 deletions

View file

@ -10,7 +10,8 @@ plugins=(... toolbox)
## Prompt function ## Prompt function
This plugins adds `toolbox_prompt_info()` function. Using it in your prompt, it will show the toolbox indicator ⬢ (if you are running in a toolbox container), and nothing if not. This plugins adds `toolbox_prompt_info()` function. Using it in your prompt, it will show the toolbox
indicator ⬢ (if you are running in a toolbox container), and nothing if not.
You can use it by adding `$(toolbox_prompt_info)` to your `PROMPT` or `RPROMPT` variable: You can use it by adding `$(toolbox_prompt_info)` to your `PROMPT` or `RPROMPT` variable:
@ -18,9 +19,11 @@ You can use it by adding `$(toolbox_prompt_info)` to your `PROMPT` or `RPROMPT`
RPROMPT='$(toolbox_prompt_info)' RPROMPT='$(toolbox_prompt_info)'
``` ```
In the same way, it adds `toolbox_prompt_name()`, showing the name of the containerized environment.
## Aliases ## Aliases
| Alias | Command | Description | | Alias | Command | Description |
|-------|----------------------|----------------------------------------| | ----- | --------------- | ------------------------------------ |
| tbe | `toolbox enter` | Enters the toolbox environment | | tbe | `toolbox enter` | Enters the toolbox environment |
| tbr | `toolbox run` | Run a command in an existing toolbox | | tbr | `toolbox run` | Run a command in an existing toolbox |

View file

@ -3,8 +3,7 @@ function toolbox_prompt_info() {
} }
function toolbox_prompt_name() { function toolbox_prompt_name() {
[[ -f /run/.containerenv ]] && [[ -f /run/.containerenv ]] && cat /run/.containerenv | awk -F\" '/name/ { print$2 }'
echo $(cat /run/.containerenv | awk -F\" '/name/ { print$2 }')
} }
alias tbe="toolbox enter" alias tbe="toolbox enter"