diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2025-01-14 22:55:05 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2025-01-14 22:55:05 -0800 |
commit | 0bbe75fd3b73c309df0f1c76b38b7692f983cd19 (patch) | |
tree | f74b3780be88cfab8542f26757847200cd8e91f9 | |
parent | f2c6f9dceddca270943fde65b5c52972f583d329 (diff) | |
download | cdlog-0bbe75fd3b73c309df0f1c76b38b7692f983cd19.tar.gz cdlog-0bbe75fd3b73c309df0f1c76b38b7692f983cd19.tar.bz2 cdlog-0bbe75fd3b73c309df0f1c76b38b7692f983cd19.zip |
Add n command to cdr.
* cdlog.sh (cdlog.init): Keep the identity of the freshly
allocated session in the variable cdlog_new_dirs.
(cdlog.recover): Allow the user to use 'n' to select the
newly allocated session.
* README.md: Documented.
-rw-r--r-- | README.md | 14 | ||||
-rw-r--r-- | cdlog.sh | 6 |
2 files changed, 15 insertions, 5 deletions
@@ -50,11 +50,15 @@ pick which directory to change to or swap with. The terminal cursor is then retraced back to the top of the menu, and the screen is erased from 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. Deleting unwanted -sessions is possible with a `d` prefix. +* The `cdr` command is used for recovering previous sessions. +When `cdlog` started, it allocated a new session. +The `cdr` recovery command presents you with a numbered list of previous +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. Deleting +unwanted sessions is possible with a `d` prefix. The `n` choice will select +again the new session that `cdlog` had allocated on startup, and that one +won't appear in the list of recoverable sessions unless it has been already +persisted by the execution of a directory-changing command. * The `cdalias` command is used for defining "cd aliases"; see below. @@ -80,6 +80,7 @@ cdlog.init() fi cdlog_dirs=~/.cdlog.$context.dirs + cdlog_new_dirs=$cdlog_dirs rm -f $cdlog_dirs set -- ~/.cdlog.*.dirs @@ -116,6 +117,7 @@ cdlog.recover() 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 + printf "n to use newly allocated,\n" $i fi printf "or Enter to keep current context: " read sel @@ -140,6 +142,10 @@ cdlog.recover() rm "$sel" && printf "Deleted!\n" fi ;; + ( n ) + cdlog_dirs=$cdlog_new_dirs + break + ;; ( "" ) break ;; |