aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2024-03-14 20:45:01 -0700
committerKaz Kylheku <kaz@kylheku.com>2024-03-14 20:45:01 -0700
commit6de647b88df2d25e80e9016c5a9e75122488e7d0 (patch)
tree3b36242720909fe7853f365642e51ab9fdcf3dd7
parentacaae64ab3bf58d7042efb907d15fa359e70a831 (diff)
downloadcdlog-6de647b88df2d25e80e9016c5a9e75122488e7d0.tar.gz
cdlog-6de647b88df2d25e80e9016c5a9e75122488e7d0.tar.bz2
cdlog-6de647b88df2d25e80e9016c5a9e75122488e7d0.zip
cdr: delete unwanted contexts with d prefix.
* cdlog.sh (cdlog.recover): Support d prefix. We only mention it in the prompt if there are two or more contexts. * README.md: Documented.
-rw-r--r--README.md3
-rw-r--r--cdlog.sh10
2 files changed, 11 insertions, 2 deletions
diff --git a/README.md b/README.md
index a23697b..d0b26b0 100644
--- a/README.md
+++ b/README.md
@@ -53,7 +53,8 @@ that point to the bottom.
* The `cdr` command is used for recovering previous sessions. It
presents you with a numbered list of these sessions. You can recover to one of
the sessions, use a `c` prefix on the number to clone the session into
-the current session, or press Enter to do nothing.
+the current session, or press Enter to do nothing. Deleting unwanted
+sessions is possible with a `d` prefix.
* The `cdalias` command is used for defining "cd aliases"; see below.
diff --git a/cdlog.sh b/cdlog.sh
index 503c203..626189a 100644
--- a/cdlog.sh
+++ b/cdlog.sh
@@ -108,7 +108,9 @@ cdlog.recover()
if [ $i -eq 1 ] ; then
printf "Use 1 to select context, c1 to clone,\n"
else
- printf "Use 1-%s to select context, c1-c%s to clone,\n" $i $i
+ printf "Use 1-%s to select context,\n" $i
+ printf "c1-c%s to clone,\n" $i
+ printf "d1-d%s to delete,\n" $i
fi
printf "or Enter to keep current context: "
read sel
@@ -127,6 +129,12 @@ cdlog.recover()
break
fi
;;
+ ( d[1-9] )
+ sel=$(cdlog.get_param ${sel#d} "$@")
+ if [ -n "$sel" ] ; then
+ rm "$sel" && printf "Deleted!\n"
+ fi
+ ;;
( "" )
break
;;