4. Complex Target - SuperCuber/dotter GitHub Wiki
Dotter supports configuring targets of files using the following syntax:
[zsh.files]
zshrc = { target = "~/.zshrc", type = "symbolic" }
zprofile = { target = "~/.zshrc", type = "template" }
Use this to override Dotter's default detection behavior, where it checks whether the file contains {{
to see if it's a template or a symlink.
There is also an owner
field - it can either be an integer for a UID or a string for a username.
To set the owner on a unix system, Dotter will use sudo
to request elevation.
When type = "template"
, Dotter also supports additional arguments:
[zsh.files]
zprofile = { target = "~/.zshrc", type = "template", append = "text to append", prepend = "text to prepend" }
This can be useful in certain cases in local.toml
.
An alternative syntax for this is:
[zsh.files.zprofile]
target = "~/.zshrc"
type = "template"
append = """
I can use
multiline text
here!
"""
TOML actually sees those two as equivalent, the difference is purely cosmetic.
Conditional file
If you want to control whether a file is included based on the result of a helper or a variable, use the if
field, like so:
[zsh.files.zprofile]
target = "~/.zshrc"
type = "symbolic"
if = "bash"
# This expression is evaluated just like the argument of an {{#if}}
if = "(eq shell 'bash')"