Skip to content
Snippets Groups Projects
Commit 84c44879 authored by nimrod's avatar nimrod
Browse files

Cleanup command notifier and my fancy prompt.

parent 04cc6907
Branches
No related tags found
No related merge requests found
...@@ -241,10 +241,7 @@ __prompt () { ...@@ -241,10 +241,7 @@ __prompt () {
[ "${runduration:-0}" -lt "10" ] || prompt="$(cyan -n "[Run duration: $runduration]") $prompt" [ "${runduration:-0}" -lt "10" ] || prompt="$(cyan -n "[Run duration: $runduration]") $prompt"
[ -n "${runduration:-}" ] || exitstatus='0' [ -n "${runduration:-}" ] || exitstatus='0'
[ "$exitstatus" = "0" ] || prompt="$(red -n "[Exit status: $exitstatus]") $prompt" [ "$exitstatus" = "0" ] || prompt="$(red -n "[Exit status: $exitstatus]") $prompt"
echo "$prompt" echo -n "$prompt"
}
__prompt_command () {
trap __command_notifier debug trap __command_notifier debug
} }
...@@ -252,7 +249,7 @@ __command_notifier () { ...@@ -252,7 +249,7 @@ __command_notifier () {
local exitstatus="$?" local exitstatus="$?"
local now runduration local now runduration
now="$(date +%s)" now="$(date +%s)"
if [ -n "${last_finish:-}" ] && [ "$last_command" != "__prompt_command" ] if [ -n "${last_finish:-}" ] && [ "$last_command" != "__prompt" ]
then then
runduration="$(( now - last_finish ))" runduration="$(( now - last_finish ))"
if [ "$runduration" -gt "10" ] if [ "$runduration" -gt "10" ]
...@@ -292,8 +289,7 @@ then ...@@ -292,8 +289,7 @@ then
export CDPATH="$HOME:$HOME/Documents:$HOME/Documents/Shore:$HOME/Documents/Endless" export CDPATH="$HOME:$HOME/Documents:$HOME/Documents/Shore:$HOME/Documents/Endless"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
export PS0='$(__prerun)' export PS0='$(__prerun)'
export PS1='\[$(__prompt)\]\u@\h:\w\$ ' export PROMPT_COMMAND='__prompt'
export PROMPT_COMMAND='__prompt_command'
shopt -s checkwinsize shopt -s checkwinsize
shopt -s cmdhist shopt -s cmdhist
# shellcheck disable=SC1091 # shellcheck disable=SC1091
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment