Parent directory

toolbox.plugin.zsh

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