diff --git a/src/plugins/terminal/scripts/init-alpine.sh b/src/plugins/terminal/scripts/init-alpine.sh index 1f051f06c..f792a46d2 100644 --- a/src/plugins/terminal/scripts/init-alpine.sh +++ b/src/plugins/terminal/scripts/init-alpine.sh @@ -92,6 +92,39 @@ export TERM=xterm-256color SHELL=/bin/bash export PIP_BREAK_SYSTEM_PACKAGES=1 +# Smart path shortening function (fish-style: ~/p/s/components) +_shorten_path() { + local path="$PWD" + + if [[ "$HOME" != "/" && "$path" == "$HOME" ]]; then + echo "~" + return + elif [[ "$HOME" != "/" && "$path" == "$HOME/"* ]]; then + path="~${path#$HOME}" + fi + + [[ "$path" == "~" ]] && echo "~" && return + + local parts result="" + IFS='/' read -ra parts <<< "$path" + local len=${#parts[@]} + + for ((i=0; i> "$PREFIX/alpine/initrc" + # Smart path shortening (fish-style: ~/p/s/components) + echo 'PS1="\[\033[1;32m\]\u\[\033[0m\]@localhost \[\033[1;34m\]\$_PS1_PATH\[\033[0m\] \[\$([ \$_PS1_EXIT -ne 0 ] && echo \"\033[31m\")\]\$\[\033[0m\] "' >> "$PREFIX/alpine/initrc" + # Simple prompt (uncomment below and comment above if you prefer full paths) + # echo 'PS1="\[\033[1;32m\]\u\[\033[0m\]@localhost \[\033[1;34m\]\w\[\033[0m\] \$ "' >> "$PREFIX/alpine/initrc" fi chmod +x "$PREFIX/alpine/initrc" -#actual souce +#actual source #everytime a terminal is started initrc will run "$PREFIX/axs" -c "bash --rcfile /initrc -i"