From 50d5e9122a0476103bed306b0769c040fb4e9f30 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Tue, 8 Feb 2022 11:59:20 +0100 Subject: bashboard highlights --- bash/board.bash | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'bash') diff --git a/bash/board.bash b/bash/board.bash index 265255a..dfee05f 100644 --- a/bash/board.bash +++ b/bash/board.bash @@ -7,6 +7,9 @@ BB_PRUNE_DAYS=5 [ ! -d "$BB_HIST_DIR" ] && mkdir -p "$BB_HIST_DIR" +BB_COLOR_HIGHLIGHT="\e[0;34m" +BB_COLOR_RESET="\e[39m" + # format # NUM EPOCH PATH @@ -45,9 +48,21 @@ function bashboard { cnt=0 while read -r line; do + local DIR BNAME DNAME read -r BB_NUM BB_DATE BB_DIR <<< "$line" + # Trailing / in $HOME - echo "[$cnt] ${BB_DIR##$HOME}" + DIR="${BB_DIR##"$HOME"}" + BNAME="$(basename "$DIR")" + DNAME="$(dirname "$DIR")" + + if [ "$DNAME" = "." ]; then + DNAME="" + else + DNAME="$DNAME/" + fi + + printf "[$cnt] $DNAME$BB_COLOR_HIGHLIGHT$BNAME$BB_COLOR_RESET\n" BB_SHORTCUT+=("$BB_DIR") -- cgit v1.2.3