A CLI to manage daily journal entries
Project description
clerk
Simple CLI to create new Markdown journal entry files.
Usage
$ journal
# Creates or re-opens today's journal
$ journal tomorrow
# Creates or re-opens tomorrow's journal
$ journal last friday
# Creates or re-opens last friday's journal
Installation
$ pipx install josephhaaga-clerk && pipx ensurepath
Setup
Create a .clerkrc file in your home directory that looks like the following, but fill in your own details. For example, here's mine!
[DEFAULT]
journal_directory=~/journals # where your journals will be created
preferred_editor=vi # or code, nano, emacs, babi
date_format=%%Y-%%m-%%d # double % required - used in datetime's strftime()
file_extension=md # or rst, txt
Note: ini files don't support comments; remove those!
Hooks
As of v0.0.2, you can add custom callback functions. Simply add the callback name in your .clerkrc, and ensure the package is installed!
For example, here's how you'd configure clerk-timestamp to fire every time you open a journal
[DEFAULT]
...
[hooks]
JOURNAL_OPENED =
timestamp
Callback-specific configuration can be provided in a separate block in your .clerkrc config file (see clerk-timestamp example)
Custom Callback functions
Callback functions receive the entire journal document as a list of lines List[str], and can return their own List[str] of lines that will overwrite the document. (return None or False if you don't wish to make any changes)
Note that callback functions are called in the order they're listed, so in the following configuration, will receive the output of the first callback function. In the following example, timestamp receives the output of fortune-cookie
[DEFAULT]
...
[hooks]
NEW_JOURNAL_CREATED =
fortune-cookie
timestamp
Available Hooks
All hooks have the following interface
Input:
- a
Sequence[str]representing the lines in the journal document - a
Mappingcontaining any user-provided configuration
Output: a List[str] representing the updated journal document (returning None or False will prevent any update)
New journal created
The NEW_JOURNAL_CREATED hook runs whenever the user opens a journal file that does not exist yet.
Journal opened
The JOURNAL_OPENED hook runs whenever the user opens a journal file.
Journal saved
The JOURNAL_SAVED hook runs whenever a user saves their journal (resulting in the file's md5 hash changing).
Journal closed
The JOURNAL_CLOSED hook runs whenever a user closes their journal.
Development
$ python3 -m pip install pytest pytest-cov pytest-xdist
# Re-run tests whenever a file is changed
$ PYTHONPATH=${PWD} python3 -m pytest -f
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file josephhaaga-clerk-0.0.12.tar.gz.
File metadata
- Download URL: josephhaaga-clerk-0.0.12.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a72aa86bf2956cbea32b60ed6b1527c200c73c892bcd022df3ed1c886c5b43a7
|
|
| MD5 |
ae32296bfd164bd7747d595f5c64ce09
|
|
| BLAKE2b-256 |
021be0e308b933c3017654f4af4b33b1d3576c4d864a6bdc9ceeed846cd3ec69
|
File details
Details for the file josephhaaga_clerk-0.0.12-py3-none-any.whl.
File metadata
- Download URL: josephhaaga_clerk-0.0.12-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d002a827c44df66de3a2a048a666f970000d857e2c8fbbb7fee5b50763c9cbe9
|
|
| MD5 |
7e4eaefd72ecff11f13385a5be71e17b
|
|
| BLAKE2b-256 |
83074be68cd51aed8bc1c1ec304d5f2dba00d048e7123810ea7a0b730fa4d99c
|