dotter: Add default variable template helper

This commit is contained in:
Marty Oehme 2025-09-21 10:43:49 +02:00
parent 0986892dce
commit e57cfb77fc
Signed by: Marty
GPG key ID: 4E535BC19C61886E
2 changed files with 13 additions and 0 deletions

View file

@ -4,6 +4,7 @@
default_target_type = "symbolic" default_target_type = "symbolic"
[helpers] [helpers]
with_default = ".dotter/helpers/var_with_default.rhai"
# BASE: A base system. Sets up a nice xdg (zsh) shell environment, utility scripts and # BASE: A base system. Sets up a nice xdg (zsh) shell environment, utility scripts and
# a development environment based on git and nvim. # a development environment based on git and nvim.

View file

@ -0,0 +1,12 @@
// tests the type of variable passed in
// if 'no' type (does not exist or cant be parsed)
// we return the second, 'default' variable
fn choose(a, b) {
if type_of(a) != "()" {
return a;
}
return b;
}
choose(params[0], params[1])