Skip to content

Commit

Permalink
updated how prompt alert works
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Garby committed Apr 18, 2024
1 parent 07a1c9d commit f6e93d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
2 changes: 2 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/bash

# This could be done with a link, but since the resman code resides in my own home directory,
# most people would not have permission to execute that file.
cp ./resman.py /usr/bin/resman
echo "Installed successfully at /usr/bin/resman. Make sure /usr/bin is in \$PATH"

Expand Down
15 changes: 2 additions & 13 deletions prompt-alert.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,2 @@
# Set RESMAN_ALERT to a red `!` when the system is reserved
update_resman_alert() {
if resman; then
RESMAN_ALERT=""
else
RESMAN_ALERT=$'\e[31m!\e[0m'
fi
}

PS1='${RESMAN_ALERT}'$PS1

# Recompute RESMAN_ALERT every time the prompt is refreshed
PROMPT_COMMAND="update_resman_alert;${PROMPT_COMMAND:+$PROMPT_COMMAND}"
_RESMAN_WORD="server in use..."
PS1='$(if resman; then echo; else printf "\[\033[0;31m\](${_RESMAN_WORD})\[\033[0m\] "; fi)'"${PS1}"

0 comments on commit f6e93d2

Please sign in to comment.