Skip to main content

corgi - Command line ORG mode General Interface

Corgi is a command line interface for analyzing and manipulating org-mode files. It implements its own parser of org syntax and doesn't rely on Emacs. It can interoperate with other tools by creating a simple Abstract Syntax Tree of org documents and outputting it as human-readable JSON. It can also recreate org documents from such JSONs, so any third-party tools must only know how to manipulate them instead of org documents, which is much easier task.

Corgi is good at manipulating document structure, so its main purpose is to give users ability to perform tasks such as refiling or displaying simple agendas from command line. I doesn't implement most of typical org-mode features, like literate programming, spreadsheets etc. It doesn't follow recent org-mode. In fact, it doesn't do a lot to interpret org-mode sections at all (sections are blocks of free text under each headline). Emacs or other third-party tools should be used for that. However, Corgi can be used as intermediate step which presents data to other programs in a friendlier way than org documents.

Due to these constraints, Corgi is reliable. Most org-mode features depend on "magical" analysis of plain text inside the sections of org documents, but just passing through their explicit contents will always work.

Configuration

Corgi is zero-config program, which means that it doesn't need a configuration file, but it helps if you don't like its default behaviour. It is configured via a TOML file and is stored in ~/.config/corgi/config.toml (Corgi also respects XDG_CONFIG_HOME variable).

There are two main sections of configuration file: [corgi], for corgi-specific options and [org] for equivalents of org-mode configuration options. Options in [org] section are named similarily to their org-mode equivalents: dashes are replaced with underscores and org- prefix is removed, due to being in [org] section. Here are the most important ones:

corgi.default_editor : text editor which corgi runs for example when running a capture subcommand. Corgi creates a temporary org file which is placed in either a {} placeholder, or at the end of the string.

org.default_notes_file : default notes file for capture. This file is also counted towards agenda files.

org.agenda_files : list of files which will be scanned to create agenda views. This list might contain directories, in which case all org files inside them will be used. It can also contain a globbing expressions, which select all the matching files. Example: ["~/org", "~/sync/*.org", "~/file.org"]

org.todo_keywords : list of keywords recognized as TODO states. It has the same format as org-todo-keywords. Example: ["TODO", "WAIT", "|", "DONE"]. If bar is not present on that list, the last keyword will be considered as "done" state.

Usage

Corgi has built-in help:

$ corgi --help
$ corgi <subcommand> --help

Dumping org files to and from JSON

Below commands show how Corgi can be used as a filter to serialize org files into JSON and then deserialize this JSON back to org files. This is extremely powerful technique, because it lets using third party programs, which only have to deal with JSON and don't need to understand the org syntax.

$ corgi serialize file.org | corgi deserialize

One exampe is to use jq, a powerful and popular command-line JSON processor. We could use it for example to filter only headlines which have a TODO state:

$ corgi serialize file.org | jq 'map(select(.keyword == "TODO"))' | corgi deserialize

Agenda

One of the most recognized org-mode features is its agenda. Corgi implements basic agenda views (although they are not nearly as powerful as Emacs' ones, nor they are interactive).

Week Agenda

Week agenda is the default view of Corgi and shows a week view of planned tasks.

$ corgi agenda

This list can be filtered only to TODO entries under a specific headline, in specific file:

$ corgi agenda --filter-path todo.org/Current

We can also use different files than the ones configured by org.agenda_files:

$ corgi agenda ~/foo/bar/{file1,file2}.org \
    --filter-path file1.org/Headline \
    --filter-path "file2.org/Other headline"

List of TODO entries

To produce a list of all TODO entries from org.agenda_files, we can use agenda --todo subcommand:

$ corgi agenda --todo

TODO agenda can use the same switches (e.g. --filter-path as the default agenda.

Metadata

Release files for corgi-org-tool 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for corgi-org-tool 0.1.0
File Size Uploaded
corgi-org-tool-0.1.0.tar.gz 29.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for corgi-org-tool 0.1.0
File Interpreter ABI Platform
corgi_org_tool-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 63.3 kB

Release files / corgi-org-tool-0.1.0.tar.gz

Download URL corgi-org-tool-0.1.0.tar.gz
Size 29.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2eab97aaabd2e6b074422074a2acc67ad93a439680e411b972178e126f6dd7fe
BLAKE2b-256 checksum
How to use checksums
9da0bd1425e0e617f37a93769ba8a23fb359fd4a5afa6e9e8757ef854a933aaa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0a2 CPython/3.9.2 Linux/5.10.0-11-amd64

Release files / corgi_org_tool-0.1.0-py3-none-any.whl

Download URL corgi_org_tool-0.1.0-py3-none-any.whl
Size 33.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
757a31c3f088c76db662df8a5f59131076d3e87efe39f2eeb9b3b1c418c59d8f
BLAKE2b-256 checksum
How to use checksums
b75d47c995029b7eaed7d54bbf8691eb221890fbdec4bb950eda9cd2397cb1e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0a2 CPython/3.9.2 Linux/5.10.0-11-amd64

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page