Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Latest commit

 

History

History
31 lines (21 loc) · 846 Bytes

templates.md

File metadata and controls

31 lines (21 loc) · 846 Bytes

Templates

Templates are used in the following locations:

  • .tool-versions files
  • .mise.toml files for most configuration
  • (Submit a ticket if you want to see it used elsewhere!)

The following context objects are available inside templates:

  • env: HashMap<String, String> – current environment variables
  • config_root: PathBuf – directory containing the .mise.toml file

As well as these functions:

  • exec(command: &str) -> String – execute a command and return the output

Templates are parsed with tera—which is quite powerful. For example, this snippet will get the directory name of the project:

[env]
PROJECT_NAME = "{{config_root | split(pat='/') | last}}"

Here's another using exec():

[aliases]
current = "{{exec(command='node --version')}}"