Mithril Configuration File Format
Mithril configuration files are parsed in a line-oriented fashion (that
is, each line represents a single directive, except in a few special cases,
described below). Whitespace at the beginning and end of lines is ignored.
There are three types of line directives:
- Comments
- A line beginning with a ``#'' character indicates a comment that
stretches to the end of the line. Example:
# This is a comment
- Sections
- A line consisting of text within square brackets ([]) indicates
the beginning of a section. A section is ended by end-of-file or by the
start of a different section. Whitespace between the name and the brackets is
ignored. Section names are case-insensitive. Example:
# This is equivalent to [ section name ] but not [ section name ]
[section name]
- Key/Value pairs
- Key value pairs consist of a case-insensitive text key followed by an
assignment token and a value. There are two assignment tokens:
- =
- The equals token indicates that all text on the right side of
the token specifies the value of the key. Whitespace on either
side of the token is ignored. Example:
# Notice that the key and value can have spaces.
foo = bar
this is my key = this is my value
- =<<
- The "here document" token also assigns a value to the key, but
allows for multi-line documents. The token is immediately
followed by a delimiter which, on a line by itself, indicates
the end of the input. If a ``-'' is the first character
of the delimiter, it indicates that leading whitespace will
be trimmed from all lines, allowing more natural formatting
of the data (note that the ``-'' is not actually part of the
delimiter). Example:
# This is a "here document" with whitespace preserved
key with whitespace =<<EOF
this is a mult-line
value with whitespace formatting.
EOF
# This is a "here document" with whitespace trimmed
key without whitespace =<<-THEEND
the leading whitespace will be trimmed
allowing an easier-to-read formatting
THEEND