diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2024-03-14 20:45:01 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2024-03-14 20:45:01 -0700 |
commit | 6de647b88df2d25e80e9016c5a9e75122488e7d0 (patch) | |
tree | 3b36242720909fe7853f365642e51ab9fdcf3dd7 | |
parent | acaae64ab3bf58d7042efb907d15fa359e70a831 (diff) | |
download | cdlog-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.md | 3 | ||||
-rw-r--r-- | cdlog.sh | 10 |
2 files changed, 11 insertions, 2 deletions
@@ -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. @@ -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 ;; |