templates/README.md
author Mikael Berthe <mikael@lilotux.net>
Sun, 07 May 2017 16:38:52 +0200
changeset 86 9e846c5af138
parent 82 9ac2281c07d7
child 94 4c0206d283e5
permissions -rw-r--r--
Update template README
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
86
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
     1
# Templates and Themes
23
2ba1ea451669 Add template samples
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     2
2ba1ea451669 Add template samples
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     3
This folder contains sample templates to customize madonctl output.
2ba1ea451669 Add template samples
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     4
86
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
     5
Feel free to contribute if you have nice templates or if you want to work on themes as well!
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
     6
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
     7
## Configuration
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
     8
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
     9
The template prefix directory can be set in the configuration file with the
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    10
'template_directory' setting, or with the `MADONCTL_TEMPLATE_DIRECTORY`
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    11
environment variable.\
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    12
If set, template files are looked up relatively from this repository first
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    13
(unless they are absolute paths or start with "./" or "../").
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    14
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    15
The themes are located in the `themes` directory, inside the base template
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    16
directory.
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    17
A theme is a collection of templates grouped in a theme directory (the name of
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    18
the directory is the name of the theme).\
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    19
E.g. `$template_directory/themes/ansi/`
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    20
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    21
## Templates
23
2ba1ea451669 Add template samples
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    22
2ba1ea451669 Add template samples
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    23
Here's an example using a template with ANSI color escape codes (for UNIX/Linux):
2ba1ea451669 Add template samples
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    24
2ba1ea451669 Add template samples
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    25
    madonctl timeline --limit 2 --template-file ansi-status.tmpl
2ba1ea451669 Add template samples
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    26
86
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    27
## Themes
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    28
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    29
To use a theme, simply specify the theme name with the --theme flag (the
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    30
--output=theme flag is implied):
82
9ac2281c07d7 Add 'template_directory' setting
Mikael Berthe <mikael@lilotux.net>
parents: 23
diff changeset
    31
86
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    32
    madonctl timeline --limit=2 --theme=ansi
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    33
    madonctl accounts statuses --limit 5 --theme ansi
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    34
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    35
    madonctl --theme=ansi accounts notifications --list
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    36
    madonctl --theme=ansi stream
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    37
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    38
Currently, if a template is missing, madonctl will fall back to the _plain_
9e846c5af138 Update template README
Mikael Berthe <mikael@lilotux.net>
parents: 82
diff changeset
    39
output format.  (In the future it might just fail with an error message.)