aboutsummaryrefslogtreecommitdiffstats
path: root/cdlog.sh
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Implement autocs mode."Kaz Kylheku2024-02-231-17/+0
| | | | This reverts commit efcc4b981d2a10ac3b10522c596f8bf9ddff6ff9.
* New cd alias feature.Kaz Kylheku2024-02-231-2/+33
| | | | | | | | | * cdlog.sh (cdlog_alias): New global array. * README.md: Documented. (cdlog.chdir): Check for and expand alias. (cdlog.alias): New function. (cdalias): New alias.
* Implement autocs mode.Kaz Kylheku2024-02-221-0/+19
| | | | | | | | | | | * cdlog.sh (cdlog_autocs): New variable. (cdlog.chdir): Implement autocs logic, if enabled. (cdlog.mcd): Use Bash dynamic scoping to override the cdlog_autocs variable false; we don't want mcd to have swapping semantics regardless of autocs mode; the user must use the distinct command mcs. * README.md: Documented.
* bug: path 8 duplicated into 9.Kaz Kylheku2024-02-131-1/+1
| | | | * cdlog.sh (cdlog.args): c9 wrongly assigned $8.
* Split off recovery from initialization.Kaz Kylheku2024-02-131-6/+17
| | | | | | | | | | | | | | Prompting the user on startup can be a nuisance. For instance, each time I make a new shell out of a text editor, I get the prompt. Let's just leave the user in a new context, and make it an explicit command to switch context. * cdlog.sh (cdlog.init): Remove logic for selecting a new context, leaving only the allocation of a new context. (cdlog.recover): New function, split off from cdlog.init. (cdr): New alias. * README.md: Documented.
* Implement context cloning.Kaz Kylheku2024-02-081-3/+15
| | | | | | | | | | The user can copy a given context into the newly allocated one, rather than switch to a given context. * cdlog.sh (cdlog.init): Allow the user to input a context number prefixed by c. In that case, we copy the specified context file into the $cdlog_dirs file, leaving that variable alone.
* bugfix: don't let user select invalid context number.Kaz Kylheku2024-02-081-1/+2
| | | | | | * cdlog.sh (cdlog.get_param): Only produce output if shift succeeds. If shift fails, it means that many shifts are not possible and the parameters are unaffected.
* Implement multiple persisted sessions.Kaz Kylheku2024-02-081-4/+68
| | | | | | | | | | | * cdlog.sh (cdlog.update): Name of file is now in $cdlog_dirs. (cdlog.get_param): New function. (cdlog.init): Implement the LRU session selection and optional recovery. The variable $cdlog_dirs is established, pointing to the selected session file. (mainline): Run cdlog.init if $cdlog_dirs is empty. * README.md: Documented.
* Persist state in ~/.cdlog.dirs.Kaz Kylheku2024-02-081-14/+45
| | | | | | | | | | | | | | | | | * cdlog.sh (cdlog.nicks): Function removed. (cdlog.update): New function, performing task of cdlog.nicks as well as persistence to ~/.cdlog.dirs file. (cdlog.init): New function that initializes the c1-c9 variables. (mainline): Call cdlog.init. This is now done later in the file after the function definitions. (cdlog.args, cdlog.chdir): Call cdlog.update instead of cdlog.nicks. This is also how the variables $x to $w will be set the first time when recovering state, because cdlog.init calls cdlog.args to install the FIFO, and cdlog.args will call cdlog.update. * README.md: Documented.
* pd: support optional argument about which entry to pop.Kaz Kylheku2024-02-031-8/+23
| | | | | | | * cdlog.sh (cdlog.pop): Rewritten to take argument 1-9, and iterate from there. * README.md: Documented.
* cll command to list all nine.Kaz Kylheku2024-02-011-1/+9
| | | | | | | | * cdlog.sh (cdlog): Take -l option to print all nine directories in the FIFO. (cll): New alias, for cdlog -l. * README.md: Documented.
* Don't use global x for looping.Kaz Kylheku2024-02-011-2/+2
| | | | | | * cdlog.sh (cdlog.mcd): Oh boy; we have used our own $x variable as a loop dummy. Switch to i which is set up as local.
* mcd: scroll-region-friendly line clearing.Kaz Kylheku2024-02-011-1/+4
| | | | | | | | | * cdlog.sh (cdlog.mcd): Going up ten lines with \e[10A and then clearing to the end of screen with \e[J is unfriendly when the user has a scroll-protected region at the bottom showing a status line. Instead, let us go up one line at a time ten times with \e[A, and clear each line to end of line with \e[K.
* Use range expansion.Kaz Kylheku2024-02-011-1/+1
| | | | * cdlog.sh (cdlog.mcd): Replace 1 2 3 ... 9 with {1..9}.
* New: mcd, mcs: menu-based cd and cs.Kaz Kylheku2024-01-251-0/+37
| | | | | | | * cdlog.sh (cdlog.mcd): New function. (mcd, mcs): New aliases. * README.md: Documented.
* cdlog: simplify prefixes.Kaz Kylheku2024-01-251-5/+6
| | | | | * cdlog.sh (cdlog): Just print numeric indices before the paths.
* print new PWD in pd and cs.Kaz Kylheku2024-01-251-0/+3
| | | | | * cdlog.sh (cdlog.rot, cdlog.pop): Print new current directory if change successful.
* Add cl alias for cdlog.Kaz Kylheku2024-01-231-0/+1
|
* Improve initialization.Kaz Kylheku2024-01-191-8/+6
| | | | | | * cdlog.sh (toplevel): Ensure that c1 exists, so that the init code doesn't access a nonexistent c1. Condense the assignments in the init block.
* Reduce repeated code.Kaz Kylheku2024-01-191-13/+7
| | | | | | * cdlog.sh (cdlog.rot): Eliminate repeated code, distinguishing different parts with a flag indicating the first loop iteration.
* Generalize swap to rotate.Kaz Kylheku2024-01-191-18/+28
| | | | | | | | * cdlog.sh (cdlog.swap): Function removed. (cdlog.rot): New function. (cs): Alias now points to cdlog.rot. * README.md: Updated.
* Remove repetitive code from cdlog.swap.Kaz Kylheku2024-01-191-44/+24
| | | | | | * cdlog.sh (cdlog.args): New function. (cdlog.swap): Use array to do swap in one case.
* Minor code tidying.Kaz Kylheku2024-01-191-17/+9
| | | | | | * cdlog.sh (cdlog.chdir, cdlog.swap): Condense assignment block to fewer lines. (toplevel): Move "cs" alias below.
* cs takes argument; swapping behavior removed from cd.Kaz Kylheku2024-01-191-18/+74
| | | | | | | | * cdlog.sh (cdlog.chdir): No specifial behavior when $PWD equals $c1. (cdlog.swap): Swapping behavior implemented here now, with optional numeric argument to swap with entries other than first.
* Change semantics of swap implementation.Kaz Kylheku2024-01-181-4/+4
| | | | | | * cdlog.sh (cdlog.chdir): When the user changes to $c1, let's not involve $c2 but just effectively exchange the current working directory and $c1.
* Change naming of functions to dot notation.Kaz Kylheku2024-01-181-8/+8
|
* Initial version of cdlog.Kaz Kylheku2024-01-181-0/+114