A command-line tool that pulls calendar events from various calendar providers and formats them for easy copy-pasting into markdown documents.
I currently use Obsidian to take notes. Obsidian uses markdown files, and part of the notes I take include a section for my meetings each day. In a blog post by Jon Seager, he mentions:
The agenda and the links are automatically generated using a small Go application I wrote - this application scrapes my Google Calendar, and according to some rules and the knowledge it has of my vault, generates the Markdown for the agenda and copies it to the clipboard. Each day, I sit down and type agenda at the command line, then paste into Obsidian.
I really liked this idea, so I decided to create my own version of this tool, written in Rust.
- Support for multiple calendar providers (currently Morgen.so, extensible for others)
- Configurable time formatting (strftime syntax)
- Customizable event templates using Handlebars
- Configuration via TOML file
- Environment variable support for API keys
- Clean markdown output
- Clone the repository
- Install Rust if you haven't already
- Optionally install just
- Build:
just buildorcargo build --release - Install:
just installorcargo install --path .
-
Initialize a default configuration:
agenda init
-
Set your API key:
export MORGEN_API_KEY="your-morgen-api-key"
-
Run:
agenda
The configuration file is at ~/.config/agenda/config.toml (Linux/macOS) or %APPDATA%\agenda\config.toml (Windows).
Migrating from the Go version? Re-run
agenda initto create a new TOML config. The old YAML config is not compatible.
provider = "morgen"
time_format = "%H:%M"
event_template = "- {{StartTimeFormatted}}-{{EndTimeFormatted}}: {{Title}}"
config_version = 1
[providers.morgen]
base_url = "https://api.morgen.so/v3"
env_api_key = "MORGEN_API_KEY"
calendars_to_ignore = ["ignore_this_calendar"]
[providers.morgen.headers]
Authorization = "ApiKey {API_KEY}"
Content-Type = "application/json"| Option | Type | Description | Example |
|---|---|---|---|
provider |
string | Which calendar provider to use | "morgen" |
time_format |
string | strftime format string for displaying times | "%H:%M", "%I:%M %p" |
event_template |
string | Handlebars template for formatting each event | "- {{StartTimeFormatted}}-{{EndTimeFormatted}}: {{Title}}" |
config_version |
int | Internal config version (do not change) | 1 |
| Field | Description |
|---|---|
{{Title}} |
Event title |
{{StartTimeFormatted}} |
Start time (per time_format) |
{{EndTimeFormatted}} |
End time (per time_format) |
{{Duration}} |
Duration (e.g. 1h30m) |
{{Description}} |
Event description (may be empty) |
{{Location}} |
Event location (may be empty) |
# Simple
event_template = "- {{StartTimeFormatted}}: {{Title}}"
# With end time
event_template = "- {{StartTimeFormatted}}-{{EndTimeFormatted}}: {{Title}}"
# With duration
event_template = "- {{StartTimeFormatted}} ({{Duration}}): {{Title}}"
# Bold title
event_template = "- {{StartTimeFormatted}}-{{EndTimeFormatted}}: **{{Title}}**"| Option | Description |
|---|---|
--config PATH |
Custom configuration file path |
--provider NAME |
Override the provider from config |
--time-format FORMAT |
Override the time format (strftime) |
--event-template TMPL |
Override the event template |
--verbose / -v |
Enable verbose logging |
--date DATE |
Date to fetch (YYYY-MM-DD, default: today) |
MORGEN_API_KEY— Your Morgen.so API key
- Sign up for an API key at https://platform.morgen.so
- Go to Developers API
- Generate and copy your API key
export MORGEN_API_KEY="your-key"
Implement the CalendarProvider trait in a new file under src/providers/:
pub trait CalendarProvider: Send {
fn name(&self) -> &str;
fn get_events(&self, date: NaiveDate) -> anyhow::Result<Vec<CalendarEvent>>;
}Then register the provider in create_provider() in src/providers/mod.rs.
- 09:00-10:00: Team Standup
- 10:30-11:30: Project Review
- 14:00-15:00: Client Call
- 16:00-16:30: 1:1 with Manager
MIT — see LICENSE for details.
@ptsouchlos |
|---|