aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2024-03-14 21:41:27 -0700
committerKaz Kylheku <kaz@kylheku.com>2024-03-14 21:41:27 -0700
commit5f1605f8cc791ac2fe3700484ae9ebf92db47f73 (patch)
tree8c410ba0901a0b50e7769068cb6a221ded25901c
parent6de647b88df2d25e80e9016c5a9e75122488e7d0 (diff)
downloadcdlog-5f1605f8cc791ac2fe3700484ae9ebf92db47f73.tar.gz
cdlog-5f1605f8cc791ac2fe3700484ae9ebf92db47f73.tar.bz2
cdlog-5f1605f8cc791ac2fe3700484ae9ebf92db47f73.zip
cdr: indicate the current context.
* cdlog.sh (cdlog.recover): Indicate the current context with the string [current].
-rw-r--r--cdlog.sh10
1 files 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