From 5f1605f8cc791ac2fe3700484ae9ebf92db47f73 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 14 Mar 2024 21:41:27 -0700 Subject: cdr: indicate the current context. * cdlog.sh (cdlog.recover): Indicate the current context with the string [current]. --- cdlog.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cdlog.sh b/cdlog.sh index 626189a..1b061fb 100644 --- a/cdlog.sh +++ b/cdlog.sh @@ -90,7 +90,7 @@ cdlog.init() cdlog.recover() { - local dir + local dirs local i local sel @@ -99,9 +99,11 @@ cdlog.recover() if [ $# -gt 0 -a $1 != ~/.cdlog.'*'.dirs ] ; then printf "These cdlog contexts exist:\n" i=0 - for dir in "$@"; do - printf "[%d]: %s\n" $((++i)) "$(date -r "$dir")" - sed -e '/^$/d' "$dir" | head -9 + for dirs in "$@"; do + printf "[%d]: %s%s\n" $((++i)) \ + "$([ "$dirs" = "$cdlog_dirs" ] && printf "[current] ")" \ + "$(date -r "$dirs")" + sed -e '/^$/d' "$dirs" | head -9 done while true; do -- cgit v1.2.3