diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2022-02-08 11:59:20 +0100 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2022-02-08 11:59:20 +0100 |
commit | 50d5e9122a0476103bed306b0769c040fb4e9f30 (patch) | |
tree | 09439a07d8355e463c59466a6a674aea649bc744 /bash | |
parent | bce12f04227a77b61118162b34fa1263b5847232 (diff) | |
download | dotfiles-50d5e9122a0476103bed306b0769c040fb4e9f30.tar.gz |
bashboard highlights
Diffstat (limited to 'bash')
-rw-r--r-- | bash/board.bash | 17 |
1 files changed, 16 insertions, 1 deletions
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") |