toolbox.plugin.zsh 556 B

12345678910111213141516
  1. function toolbox_prompt_info() {
  2. [[ -f /run/.toolboxenv ]] && echo "⬢"
  3. }
  4. function toolbox_prompt_name() {
  5. [[ -f /run/.containerenv ]] || return
  6. # This command reads the /run/.containerenv file line by line and extracts the
  7. # container name from it by looking for the `name="..."` line, and uses -F\" to
  8. # split the line by double quotes. Then all % characters are replaced with %%
  9. # to escape them for the prompt.
  10. awk -F\" '/name/ { gsub(/%/, "%%", $2); print $2 }' /run/.containerenv
  11. }
  12. alias tbe="toolbox enter"
  13. alias tbr="toolbox run"