Configuration

Zet reads the configuration inside TOML's .zet/zet.toml file. Empty zet.toml is created by running zet init.

Zet exports configuration to environment with added ZET_ prefix and name derived from the name of configuration option. Items of TOML's arrays of strings are separated with a semicolon ";". You can examine the output of zet env to see what environment is passed to subcommands.

Configuration Example

[command.menu.deaults]
arguments = "main:"
fresort = true

[command.journal]
template = "~/journal-template.md"
journal-directory = "journal:"

[[notebooks]]
name = "main"
path = "content/0"
default_filetype = "adoc"
remote = "ssh://git@example.com/notebook.git"

[[notebooks]]
name = "journal"
path = "content/my journal"
default_filetype = "org"
remote = "ssh://git@example.com/journal.git"

Notebooks Array

Zet discovers all of managed notebooks by reading [[notebooks]] array entries. Order in which [[notebooks]] are declared in zet.toml matters for evaluating the default notebook.

It has the following keys:

name

(mandatory)

Name of the notebook which will be used in selectors to access it. It can be any string, but for ease of access it's preferabbly a short single word, all lower-case.

path

(mandatory)

Relative path to the root directory of notebook. path is relative to the $ZET_ROOT, i.e. to the .zet directory.

default_filetype

(optional)

Change the filetype for notes which Zet should prefer when it creates new ones (for example with a bare zet note). If this option isn't set, Zet will default to md.

default_filetype should be a file extension without the initial dot.

remote

(optional)

Git URL used by zet sync to automatically initialize the notebook from remote repository. See the chapter about synchronization.

other fields

Zet commands aren't restricted only to above fields. It's possible to add any other notebook properties which custom subcommands may use however they like.

Command table

Command table contains options specific for Zet subcommands. There are no restrictions for names or types of these options, but there are some options which Zet and bundled non-core commands recognize.

command.[subcommand].defaults

Table of default command line options automatically added when subcommand is invoked, on top of options explicitly used in the invocation.

Zet converts each entry in defaults table to a command line parameter and adds it to the related command as if it were typed in command line. There are several rules on how these transformations occur:

  • entries are transformed into long options and are prefixed with 2 dashes "--";
  • value assigned to entry is passed as its next argument, similar to how --option value would be passed;
  • if value is a boolean true, then entry is considered a simple switch without any following parameter;
  • if value is an array, then entry is duplicated for each array's value;
  • values which start with a tilde "~/" are expanded to the home directory (or its equivalent) of current user;
  • special entry named arguments can be used to pass positional arguments to the command;
  • default arguments are placed before ordinary command line arguments. The order is: <configured options>, <configured positional arguments>, <command line arguments>

This feature may be disabled by running zet --no-defaults or by setting ZET_NO_DEFAULTS=1 environment variable.

Examples
foo = bar  →  --foo bar
foo = ["bar", "baz"]  →  --foo bar --foo baz
foo = true  →  --foo
arguments = ["foo" bar"]  →  foo bar