Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/CRTified/zsh-johnnydecimal
Collection of zsh scripts for working with Johnny.Decimal structure https://johnnydecimal.com/
https://github.com/CRTified/zsh-johnnydecimal
file-management johnny-decimal organization zsh-plugin
Last synced: about 2 months ago
JSON representation
Collection of zsh scripts for working with Johnny.Decimal structure https://johnnydecimal.com/
- Host: GitHub
- URL: https://github.com/CRTified/zsh-johnnydecimal
- Owner: CRTified
- License: gpl-3.0
- Created: 2019-05-04T14:59:48.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-11-12T18:12:35.000Z (about 1 year ago)
- Last Synced: 2024-08-13T07:16:08.258Z (5 months ago)
- Topics: file-management, johnny-decimal, organization, zsh-plugin
- Language: Shell
- Size: 27.3 KB
- Stars: 39
- Watchers: 5
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - CRTified/zsh-johnnydecimal - Collection of zsh scripts for working with Johnny.Decimal structure https://johnnydecimal.com/ (Shell)
README
# zsh-johnnydecimal
Collection of zsh functions to work with Johnny.Decimal document hierachies
More info can be found at https://johnnydecimal.com/## Installation
* Set the environment variable `JOHNNYDECIMAL_BASE` to the base directory
* If this is not set, it will default to `~/johnny`
* `source johnnydecimal.zsh`### NixOS + Home-Manager
Add the following input to your `flake.nix`:
``` nix
inputs = {
zsh-johnnydecimal.url = "github:CRTified/zsh-johnnydecimal";
};
```Afterwards, you can either add `zsh-johnnydecimal.nixosModules.globalModule` to your
global NixOS configuration, which makes `zsh-johnnydecimal` available for all
users configured with `home-manager`, or you add `zsh-johnnydecimal.nixosModules.hmModule`
to the modules loaded by `home-manager`.In either case, users will have two options available:
- `programs.zsh.johnnydecimal.enable` enables the J.D integration (default: `false`)
- `programs.zsh.johnnydecimal.basePath` configures the base path for your J.D file structure (default: `~/johnny/`)## Functions
### `jcd`
```
jcd CATEGORY.UNIQUE
```Changes the active directory to `CATEGORY.UNIQUE` with `pushd`.
Going back to the original directory can be done with `popd`.### `jcp`
```
jcp CATEGORY.UNIQUE SRC [SRC [SRC ...]]
```Copies `SRC` to `CATEGORY.UNIQUE`.
### `jmv`
```
jmv CATEGORY.UNIQUE SRC [SRC [SRC ...]]
```Moves `SRC` to `CATEGORY.UNIQUE`.
### `jmkarea`
```
jmkarea CATEGORY DESC
```Creates the area for `CATEGORY`, using the given description.
`CATEGORY` can be any index within the desired area.### `jmkcat`
```
jmkcat CATEGORY DESC
```Creates the category `CATEGORY` with the given description.
### `jmkuni`
``` shell
jmkuni CATEGORY.UNIQUE DESC
```Creates the unique folder `CATEGORY.UNIQUE` with the given description.
### `jwd`
``` shell
jwd CATEGORY.UNIQUE CMD [ARG [ARG [ARG ...]]]
```Executes `CMD [ARG [ARG [ARG ...]]]` inside the directory for `CATEGORY.UNIQUE`.
## Example
### Setup of Example Environment
``` shell
$ export JOHNNYDECIMAL_BASE=/tmp/jd
$ find $JOHNNYDECIMAL_BASE
# Nothing here
```### Hierachy creation
``` shell
$ jmkarea 10 Finance
mkdir: created directory '/tmp/jd/10-19 Finance'$ jmkarea 20 Administration
mkdir: created directory '/tmp/jd/20-29 Administration'$ jmkcat 21 "Company Registration"
mkdir: created directory '/tmp/jd/20-29 Administration/21 Company Registration'$ jmkcat 22 Contracts
mkdir: created directory '/tmp/jd/20-29 Administration/22 Contracts'$ jmkuni 22.01 "Cleaning contract"
mkdir: created directory '/tmp/jd/20-29 Administration/22 Contracts/22.01 Cleaning contract'$ jmkuni 22.02 "Office Lease"
mkdir: created directory '/tmp/jd/20-29 Administration/22 Contracts/22.02 Office Lease'```
The resulting file structure is
``` shell
$ find $JOHNNYDECIMAL_BASE
/tmp/jd
/tmp/jd/20-29 Administration
/tmp/jd/20-29 Administration/22 Contracts
/tmp/jd/20-29 Administration/22 Contracts/22.02 Office Lease
/tmp/jd/20-29 Administration/22 Contracts/22.01 Cleaning contract
/tmp/jd/20-29 Administration/21 Company Registration
/tmp/jd/10-19 Finance
```### Adding Files
``` shell
$ pwd
~/example
$ ls
'Security bond details.xlsx' 'Signed lease agreement.pdf' 'Terms & conditions.doc'$ jcp 22.02 Security\ bond\ details.xlsx Signed\ lease\ agreement.pdf
'Security bond details.xlsx' -> '/tmp/jd/20-29 Administration/22 Contracts/22.02 Office Lease/Security bond details.xlsx'
'Signed lease agreement.pdf' -> '/tmp/jd/20-29 Administration/22 Contracts/22.02 Office Lease/Signed lease agreement.pdf'$ jmv 22.02 Terms\ \&\ conditions.doc Signed\ lease\ agreement.pdf
copied 'Terms & conditions.doc' -> '/tmp/jd/20-29 Administration/22 Contracts/22.02 Office Lease/Terms & conditions.doc'
removed 'Terms & conditions.doc'# Note that it only copied the first file - not the second one, as that already exists
$ ls
'Security bond details.xlsx' 'Signed lease agreement.pdf'
$ find $JOHNNYDECIMAL_BASE
/tmp/jd
/tmp/jd/20-29 Administration
/tmp/jd/20-29 Administration/22 Contracts
/tmp/jd/20-29 Administration/22 Contracts/22.02 Office Lease
/tmp/jd/20-29 Administration/22 Contracts/22.02 Office Lease/Terms & conditions.doc
/tmp/jd/20-29 Administration/22 Contracts/22.02 Office Lease/Signed lease agreement.pdf
/tmp/jd/20-29 Administration/22 Contracts/22.02 Office Lease/Security bond details.xlsx
/tmp/jd/20-29 Administration/22 Contracts/22.01 Cleaning contract
/tmp/jd/20-29 Administration/21 Company Registration
/tmp/jd/10-19 Finance
```### Navigating
``` shell
$ pwd
~/example
$ jcd 22.02
/tmp/jd/20-29 Administration/22 Contracts/22.02 Office Lease ~/example
$ ls
'Security bond details.xlsx' 'Signed lease agreement.pdf' 'Terms & conditions.doc'
$ pwd
/tmp/jd/20-29 Administration/22 Contracts/22.02 Office Lease
$ popd
~/example
$ pwd
~/example
```