irongit

Update highlight-debug.sh

huncholanehuncholaneauthored committed by GitHub
parent de34a36commit 9a9b7ba5399f3f77a9c399152829dcea5e015df9Browse files

1 file changed, +4 -2

+4-2highlight-debug.sh
@@ -1,7 +1,8 @@
11 # Highlight the current directory for all commands
2+# WARNING: This changes the success status code to 69
23 shopt -s extdebug
34 highlight() {
4- if [ "$BASH_LOADED" = false ]; then
5+ if [ "$BASH_LOADED" = false ] || [ "$BASH_COMMAND" = "uh" ] || [ "$BASH_COMMAND" = "hh" ] || [[ "$BASH_COMMAND" =~ "trap" ]]; then
56 return 0 # Return 0 lets the command run how it normally would
67 fi
78 results=$(eval "$BASH_COMMAND" 2>&1)
@@ -13,6 +14,7 @@ highlight() {
1314 if [ $status=0 ]; then
1415 return 69 # 69 becomes your new success code
1516 fi
17+ echo "status: $status"
1618 return $status # Return original error code
1719 }
1820 uh() { # Unset the highlight trap
@@ -23,4 +25,4 @@ hh() { # Set the highlight trap
2325 echo -e "\033[32mSetting highlight trap\033[0m"
2426 trap highlight DEBUG
2527 }
26-trap highlight DEBUG # Set the highlight trap by default
28+# trap highlight DEBUG # Set the highlight trap by default