Add context command

main
trivernis 10 months ago
parent da6284949a
commit ab74021bae
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -39,6 +39,7 @@ contain a `dirs.toml` file that specifies a different location.
Files ending with `.tmpl` are treated as [handlebars templates](https://handlebarsjs.com/) and are processed
before being written to the target location. The `.tmpl` extension will be stripped from the filename.
You can check the available context variables and their values on the system with `silo context`.
### Applying the configuration

@ -20,4 +20,7 @@ pub enum Command {
Init,
/// Applies the configuration stored in a silo repo
Apply,
/// Print the entire context available to templates
Context,
}

@ -16,6 +16,12 @@ fn main() -> Result<()> {
match &args.command {
args::Command::Init => init(&args)?,
args::Command::Apply => apply(&args)?,
args::Command::Context => {
println!(
"{}",
serde_json::to_string_pretty(templating::context()).into_diagnostic()?
)
}
}
Ok(())

Loading…
Cancel
Save