A simple one-line diary application for the command line.
Current version: 0.9.1
diary is a lightweight CLI tool written in Go for keeping short daily notes in JSONL format.
Each entry is assigned a serial ID, only one entry is stored per date, and existing entries can be updated or deleted easily.
- Added listing by year and month with
-m YYYY-MM - Added case-insensitive text search with
-s - Added interactive search mode with
-i - Added automatic backup on add, update, and delete
- Added manual backup with
-b - Added restore from backup with
-R - Added restore confirmation that requires typing
diary
- Simple command-line interface
- Store diary entries in JSONL format
- One entry per date
- Automatic serial ID assignment
- Update an existing entry by writing to the same date
- List recent entries
- List entries for a specific month
- Search entries case-insensitively
- Interactive narrowing search
- Show entries in oldest-first or newest-first order
- Optionally display serial IDs
- Delete entries by serial ID
- Automatic backup on write
- Manual backup and restore
- TOML-based configuration
Entries are stored as JSON Lines (.jsonl), one record per line.
Example:
{"id":1,"date":"2026-03-25","text":"Went for a walk.","created_at":"2026-03-25T21:00:00+09:00","updated_at":"2026-03-25T21:00:00+09:00"}
{"id":2,"date":"2026-03-26","text":"A quiet day.","created_at":"2026-03-26T22:00:00+09:00","updated_at":"2026-03-26T22:15:00+09:00"}- Go 1.21 or later
go mod init diary
go get github.com/pelletier/go-toml/v2
go build -o diary .On Windows:
go build -o diary.exe .The application uses a TOML configuration file:
~/.config/diary/config.toml
Example:
data_file = "C:\\Users\\yourname\\diary\\diary.jsonl"
max_len = 200data_file: path to the JSONL data filemax_len: maximum number of characters allowed in one entry
diarydiary -a "A quiet day."diary -a 2026-03-25 "Went for a walk."diary -ldiary -l 30diary -r -l 30diary -m 2026-03 -ldiary -m 2026-03 -r -ldiary -s "walk"diary -m 2026-03 -s "walk"diary -idiary -bdiary -b backupsdiary -R C:\path\to\diary-backup-20260413-164441-000000000.jsonlThis command first creates a safety backup of the current data.
It then asks you to type diary before it restores.
diary -n -l 30diary -r -n -l 30diary -d 3| Command | Description |
|---|---|
diary |
Show help |
diary -l [n] |
List recent entries in oldest-first order |
diary -m YYYY-MM -l [n] |
List entries for the specified year and month |
diary -s "query" |
Search entries case-insensitively |
diary -m YYYY-MM -s "query" |
Search entries in the specified month |
diary -i |
Start interactive search mode |
diary -r -l [n] |
List recent entries in newest-first order |
diary -n -l [n] |
List recent entries with serial IDs |
diary -r -n -l [n] |
List recent entries with serial IDs in newest-first order |
diary -a "text" |
Add or update today's entry |
diary -a YYYY-MM-DD "text" |
Add or update an entry for a specific date |
diary -d ID |
Delete an entry by serial ID |
diary -b [path] |
Create a backup immediately |
diary -R backup.jsonl |
Restore from a backup file |
- Only one entry is stored per date.
- Adding a new entry for an existing date updates the previous one.
- Serial IDs are assigned only when a new entry is first created.
- Updating an existing entry keeps its original serial ID.
- Deletion is performed by serial ID.
- Text search is case-insensitive.
-istarts a prompt-based narrowing search loop and exits on an empty line.- Add, update, and delete automatically create a timestamped
.jsonlbackup. - Automatic backups are stored in an OS-local directory.
- Windows:
%LOCALAPPDATA%\diary\backups - Linux:
~/.local/share/diary/backups - macOS:
~/Library/Application Support/diary/backups -bcreates an immediate backup in the same default location unless a path is given.-Rrestores from a backup file, first saves the current data as a safety backup, and requires typingdiaryto proceed.
This project aims to be:
- small
- readable
- easy to build
- easy to back up
- easy to manage with Git
This project is licensed under the MIT License.
See the LICENSE file for details.