Tiller is a command-line application to help manage your Today I Learned (TIL) notes. It automates the process of creating, and committing new TIL entries using your preferred text editor and Git.
Its working with Hugo and you can see my til layout from my blog repo
- Opens your preferred text editor to create a new TIL entry.
- Automatically generates a new filename based on existing TIL entries.
- Prepends a customizable template to each new TIL entry.
- Commits and pushes the new TIL entry to your Git repository.
Tiller requires a configuration file to be placed in ~/.config/tiller/config.json
.
The configuration file should be in JSON format and include the following fields:
editor
: The command to open your preferred text editor.til_folder
: The path to the folder where TIL entries are stored.repo_path
: The path to your Git repository.
Example config.json
:
{
"editor": "nano",
"til_folder": "/path/to/til/folder",
"repo_path": "/path/to/git/repo"
}
Additionally, you can create a prepend.md
file in the same configuration directory to customize the content that is prepended to each new TIL entry. The file can include placeholders for the filename and date:
$TITLE
: Will be replaced with the filename (without extension).$DATE
: Will be replaced with the current date and time.
Example prepend.md
:
+++
title = '#$TITLE'
date = $DATE
draft = false
+++
- Clone the repository:
git clone https://github.com/delirehberi/tiller.git
cd tiller
- Build the project using Cargo:
cargo build --release
- Move the binary to a directory in your
PATH
(optional):
cp target/release/tiller /usr/local/bin/
Simply run the tiller
command to create a new TIL entry:
tiller
This will:
- Open your preferred text editor to create a new TIL entry.
- Automatically generate a new filename based on existing TIL entries.
- Prepend the content of
prepend.md
to the new TIL entry. - Commit and push the new TIL entry to your Git repository.
If any errors occur during the execution, they will be printed to the console. Common errors include:
- Missing configuration file.
- Failed to open the text editor.
- Issues with reading or writing files.
- Git commit or push failures.
Make sure to add these dependencies in your Cargo.toml
file:
[dependencies]
dirs = "3.0"
tempfile = "3.3"
chrono = "0.4"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Contributions are welcome! Feel free to open an issue or submit a pull request on GitHub.
This project is licensed under the MIT License.