Command Line parser, agenda and manipulator for org-mode files.
Project description
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.
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 corgi-org-tool-0.1.0.tar.gz
.
File metadata
- Download URL: corgi-org-tool-0.1.0.tar.gz
- Upload date:
- Size: 29.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0a2 CPython/3.9.2 Linux/5.10.0-11-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2eab97aaabd2e6b074422074a2acc67ad93a439680e411b972178e126f6dd7fe |
|
MD5 | 9fa109e6a2d6b4cc004421259b70ea66 |
|
BLAKE2b-256 | 9da0bd1425e0e617f37a93769ba8a23fb359fd4a5afa6e9e8757ef854a933aaa |
File details
Details for the file corgi_org_tool-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: corgi_org_tool-0.1.0-py3-none-any.whl
- Upload date:
- Size: 33.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0a2 CPython/3.9.2 Linux/5.10.0-11-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 757a31c3f088c76db662df8a5f59131076d3e87efe39f2eeb9b3b1c418c59d8f |
|
MD5 | 5d922b7cfbfca450913e105e3f8a9bda |
|
BLAKE2b-256 | b75d47c995029b7eaed7d54bbf8691eb221890fbdec4bb950eda9cd2397cb1e4 |