feat!: add builtin templates

WIP: document, check for breaking changes, decide on version, etc.
This commit is contained in:
2024-06-04 12:06:12 +02:00
parent 5b85f094de
commit 12ba1d3326
7 changed files with 228 additions and 42 deletions

View File

@@ -1,4 +1,4 @@
.TH AGENDA 1 "2024-06-07" "agenda 0.1.0"
.TH AGENDA 1 "2024-06-07" "agenda 0.2.0"
\#=============================================================================
.SH NAME
agenda \- Manage daily tasks and notes in any plain text format.
@@ -107,7 +107,26 @@ The editor process has access to certain environment variables.
\fBAGENDA_DIR\fP
.RS 4
The home of all agenda note files read and written by agenda. If this is empty
`${XDG_DATA_HOME:-"$HOME/.local/share"}/agenda` will be used.
\fBXDG_DATA_HOME\fP\fI/agenda\fP will be used.
.PP
.RE
\#
\fBAGENDA_DATA_DIRS\fP
.RS 4
Colon delimited Paths to additional files that come with an agenda installation
and custom overrides. Currently only used for template programs (located in the
\fItemplate/\fP sub-directory). If a file is searched in these paths the first file
that is found is used.
.nr PI 2n
If this variable is not set or empty it is set to include (in order)
.IP \[bu]
\fBXDG_CONFIG_HOME\fP\fI/agenda\fP
.IP \[bu]
\fI/usr/local/share/agenda\fP
.IP \[bu]
\fI/usr/share/agenda\fP
.PP
.RE
\#
@@ -127,10 +146,14 @@ The default agenda name if the \fI-t\fP option is omitted. This falls back to
\#
\fBAGENDA_TEMPLATE\fP
.RS 4
If this is not empty the value is interpreted as a command and executed when
creating a new agenda note with the \fI-c\fP flag. Any std output of the
command is written to the new file. The template process has access to certain
environment variables.
If this variable is not empty the value is interpreted as a command and
executed when creating a new agenda note with the \fI-c\fP flag. Any std output
of the command is written to the new file. The template process has access to
certain environment variables.
.PP
If this variable is unset or empty \fBAGENDA_DATA_DIRS\fP is searched for an
executable in the \fItemplates\fP sub-directory that is named either like the
corresponding extension or "default".
.sp 1
The following example will copy the last agenda note to
the new agenda note file.
@@ -153,6 +176,10 @@ Note however that this example is specific to \fBbash(1)\fP, since only bash
can export functions this way. In general you should write your template as a
script, save it, and set it as executable.
.PP
To set/override a template for a certain extension (e.g. markdown), save the
program to one of the \fBAGENDA_DATA_DIRS\fP, e.g.
\fI\fBXDG_CONFIG_HOME\fP/agenda/templates/md\fP.
.PP
\#-----------------------------------------------------------------------------
.SS "Templates and editor"
The template command and editor processes have access to certain environment
@@ -188,6 +215,21 @@ The file path of the agenda note.
The last agenda file. Can be empty if no previous agenda note exists.
.PP
.RE
.SS "Other"
\#
\fBXDG_CONFIG_HOME\fP
.RS 4
The default user configuration path. If this is not set the default of
\fBHOME\fP\fI/.config\fP is assumed.
.PP
.RE
\#
\fBXDG_DATA_HOME\fP
.RS 4
The default user data path. If this is not set the default of
\fBHOME\fP\fI/.local/share\fP is assumed.
.PP
.RE
\#=============================================================================
.SH "SEE ALSO"
\fBdate(1)\fP