diff options
Diffstat (limited to 'bash/bashrc.d')
-rw-r--r-- | bash/bashrc.d/prompt.bash | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash index a2066386..86691a9c 100644 --- a/bash/bashrc.d/prompt.bash +++ b/bash/bashrc.d/prompt.bash @@ -21,21 +21,17 @@ prompt() { fi PS1=$PS1'\w' - # Add sub-commands; VCS, job, and return status checks - PS1=$PS1'$(ret=$?;prompt vcs;prompt job;prompt ret)' - # Add a helpful prefix if this shell appears to be exotic case ${SHELL##*/} in (bash) ;; (*) PS1=bash:$PS1 ;; esac - # If torsocks is on, report that - case $LD_PRELOAD in - (*/libtorsocks.so:|*/libtorsocks.so) - PS1='[Tor]'$PS1 - ;; - esac + # Add sub-commands: + ## Preload libraries as prefix + PS1='$(prompt preload)'$PS1 + ## VCS, job, and return status checks as suffixes + PS1=$PS1'$(ret=$?;prompt vcs;prompt job;prompt ret)' # Add prefix and suffix PS1='${PROMPT_PREFIX}'$PS1'${PROMPT_SUFFIX}' @@ -99,6 +95,21 @@ prompt() { fi ;; + # Analyze LD_PRELOAD to see if we should report anything loaded + preload) + printf '%s:' "$LD_PRELOAD" | + while read -d : -r ; do + case $REPLY in + (*/libip2unix.so) + printf '[IP2Unix]' + ;; + (*/libtorsocks.so) + printf '[Tor]' + ;; + esac + done + ;; + # Git prompt function git) |