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
Setup
Create a clerk.conf
file that looks like the following, but fill in your own details
[DEFAULT]
journal_directory=/Users/josephhaaga/journals # absolute path
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!
Then, move the config file to your app directory
$ mv clerk.conf $(python3 -c "import clerk.config; print(clerk.config.dirs().user_config_dir)")
Hooks
As of v0.0.2, you can add custom callback functions. Simply add the callback name in your clerk.conf
, 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 clerk.conf
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
Mapping
containing 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.
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
File details
Details for the file josephhaaga-clerk-0.0.4.tar.gz
.
File metadata
- Download URL: josephhaaga-clerk-0.0.4.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03fbf5197cdbd8decea0ae9ca4bef8b553660abac310164ddf4fc3e6f1490036 |
|
MD5 | f016d82c78d94a7677a110cb27c230f9 |
|
BLAKE2b-256 | aa9d1d32b8b5267154650a70259995cfbfdfcedeffc45dbec1c60a97614fbe92 |
File details
Details for the file josephhaaga_clerk-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: josephhaaga_clerk-0.0.4-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b21ca10e56c3ea1f84613de88488575c985dcdb0e6bb970b1357d213077bc6f |
|
MD5 | 89282fb7dfdc143b0091d772378edbfb |
|
BLAKE2b-256 | f2da24eb943f8f236938fb8ef944cf62ea8262c8da2660c031ca221fbdec908e |