Add colorful PS4
PS4 can include functions, so when running in the LOG_COLORS=True mode
provide a grey function line so that it's easier to visually
distinguish the content from the location.
Also make it so the main prompt chunks off all the common path, which
means we can printf to 40 characters and have a pretty reasonable and
readable PS4.
Change-Id: I4a10a49db97d413349bcfceeb8c4164936fbcc40
diff --git a/tools/create_userrc.sh b/tools/create_userrc.sh
index 3325c5e..a7278e4 100755
--- a/tools/create_userrc.sh
+++ b/tools/create_userrc.sh
@@ -7,6 +7,22 @@
# Warning: This script just for development purposes
set -o errexit
+
+# short_source prints out the current location of the caller in a way
+# that strips redundant directories. This is useful for PS4
+# usage. Needed before we start tracing due to how we set
+# PS4. Normally we'd pick this up from stackrc, but that's not sourced
+# here.
+function short_source {
+ saveIFS=$IFS
+ IFS=" "
+ called=($(caller 0))
+ IFS=$saveIFS
+ file=${called[2]}
+ file=${file#$RC_DIR/}
+ printf "%-40s " "$file:${called[1]}:${called[0]}"
+}
+
set -o xtrace
ACCOUNT_DIR=./accrc
diff --git a/tools/install_pip.sh b/tools/install_pip.sh
index 2a9d813..87660a6 100755
--- a/tools/install_pip.sh
+++ b/tools/install_pip.sh
@@ -11,7 +11,6 @@
# - if USE_PYTHON3=True, PYTHON3_VERSION refers to a version already installed
set -o errexit
-set -o xtrace
# Keep track of the current directory
TOOLS_DIR=$(cd $(dirname "$0") && pwd)
@@ -23,6 +22,9 @@
# Import common functions
source $TOP_DIR/stackrc
+# don't start tracing until after we've sourced the world
+set -o xtrace
+
FILES=$TOP_DIR/files
PIP_GET_PIP_URL=https://bootstrap.pypa.io/get-pip.py