Skip to main content

Templating

You can use handlebars template syntax in dot.yaml files and the defaults file.

This allows for e.g. access to environment variables.

Variables

VariableDescriptionExample
configThe current configdepends: [ {{#each config.variables.some ~}} "{{this}}", {{/each }} ]
envA map of Environment variablessome.file: {{ env.HOME }}/some.file
nameThe name of the current dotinstalls: apt install {{ name }}
osThe current os (either windows, linux or darwin) as used in dots{{#if (eq os "windows")}}some: value{{/if}}
whoamiA map of information about the environment (see whoami). Provided by the whoami crate.some.file: /home/{{ whoami.username }}/some.file
dirsA map of directories (see below for a list of available directories). Provided by the directories crate.some.file: {{ dirs.base.home }}/some.file

whoami

VariableDescription
whoami.desktop_envInformation about the Desktop environment
whoami.devicenameThe device name
whoami.distroThe os distro
whoami.hostnameThe hostname
whoami.langAn array of the users prefered languages
whoami.platformThe current platform
whoami.realnameThe users full name
whoami.usernameThe current users username
whoami.archThe CPU architecture of the system.

directories

Variable
base.cache
base.config
base.data
base.data_local
base.home
base.preference
user.audio
user.desktop
user.document
user.download
user.home
user.picture
user.public
user.template
user.video

Helpers

Rotz comes with helpers provided by the handlebars_misc_helpers crate.

Theres also a number of inbuilt helpers provided

#windows, #linx and #darwin

These helpers are shorthands for checking the curent os.

Instea of {{ #if (eq os "windows") }}{{ else }}{{ /if }} they can be used like this {{ #windows }}{{ else }}{{ /windows }}.

eval

The eval helper can be used to evalate a string on the shell configured by shell_command.

The helper can be used like this {{ eval "some --shell command" }}