4. Handling of templates

The xrdt template CLI allows to manage XRD measurement document templates. It offers a comparable functionality as the [device](#handling-of-devices) and [preset](#handling-of-presets) CLI and allows to list, add, and remove template(s).

Each created template is stored in a specific folder with a certain name containing information of the corresponding document type and its name (do not modify the filenames). You can open and modify a specific template using the edit command. A full documentation of all commands and their options is provided in the section Command line interface.

Usage: xrdt template [OPTIONS] COMMAND [ARGS]...

  CLI to manage measurement document templates.

Options:
  --template_dir PATH  Path to the template directory.  [default:
                       ~/.local/xrdt/templates]
  --help               Show this message and exit.

Commands:
  add     Create and register a new document template.
  edit    Edit a registered measurement document template.
  list    List registered templates, optionally by type.
  remove  Remove a registered template.

There is no need to create a custom template.
If none exists, a fallback template for the specific document type is used, which is also the basis for a custom template of the corresponding type.
If a custom template for a certain document type exists, it will be taken into account for the creation of such a document type.
Currently only the document type `protocol` is supported, but the addition of further document types is envisaged.
In case multiple templates exists for the same document type, the user has to specify the one which should be applied during the creation of a document.