Update blueprint library

This commit is contained in:
2021-05-20 16:36:49 +02:00
parent 00412be372
commit 6fb96f6270
5 changed files with 46 additions and 10 deletions

5
manager/Cargo.lock generated
View File

@ -74,11 +74,12 @@ dependencies = [
[[package]] [[package]]
name = "blueprint" name = "blueprint"
version = "0.2.0" version = "0.3.0"
source = "git+https://git.nubo.sh/hulthe/blueprint.git#2d0875188e3d378a825d24348de4d92a228bf420" source = "git+https://git.nubo.sh/hulthe/blueprint.git#0af5d72005bebca426eeff628c1f010d2e850f06"
dependencies = [ dependencies = [
"nom", "nom",
"structopt", "structopt",
"thiserror",
] ]
[[package]] [[package]]

View File

@ -1,7 +1,7 @@
use crate::error::{Error, ErrorLocation, Errors, InnerError}; use crate::error::{Error, ErrorLocation, Errors};
use crate::Config; use crate::Config;
use async_recursion::async_recursion; use async_recursion::async_recursion;
use blueprint::{parse_file, Env, Value}; use blueprint::{parse_template, Env, Value};
use futures::future::join_all; use futures::future::join_all;
use serde::Serialize; use serde::Serialize;
use std::ffi::OsStr; use std::ffi::OsStr;
@ -105,8 +105,7 @@ async fn file(cfg: &Config, env: &Env, relative: PathBuf) -> Result<(), Error> {
.with_location(&template_path)?; .with_location(&template_path)?;
let mut rendered = Vec::<u8>::new(); let mut rendered = Vec::<u8>::new();
parse_file(&file_str) parse_template(&file_str)
.map_err(|_| InnerError::TemplateParseErr)
.with_location(&template_path)? .with_location(&template_path)?
.write(&env, &mut rendered) .write(&env, &mut rendered)
.with_location(&template_path)?; .with_location(&template_path)?;

View File

@ -18,7 +18,7 @@ pub enum InnerError {
IoErr(#[from] io::Error), IoErr(#[from] io::Error),
#[error("Failed to parse template file")] #[error("Failed to parse template file")]
TemplateParseErr, TemplateErr(#[from] blueprint::Error),
} }
impl From<Vec<Error>> for Errors { impl From<Vec<Error>> for Errors {

View File

@ -123,9 +123,7 @@ colors:
magenta: '0x8f3f71' magenta: '0x8f3f71'
cyan: '0x427b58' cyan: '0x427b58'
white: '0x3c3836' white: '0x3c3836'
{% end %} {% else %}
{% if dark %}
# Colors (Gruvbox dark) # Colors (Gruvbox dark)
colors: colors:
# Default colors # Default colors

View File

@ -6,11 +6,18 @@ vicmd_symbol = "[⤶](bold green)"
[username] [username]
show_always = true show_always = true
{% if demo %}
format = "[demo]($style) in "
{% else %}
format = "[$user]($style)@" format = "[$user]($style)@"
{% end %}
[hostname] [hostname]
ssh_only = false ssh_only = false
format = "[$hostname]($style) in " format = "[$hostname]($style) in "
{% if demo %}
disabled = true
{% end %}
[custom.stl] [custom.stl]
description = "time logger" description = "time logger"
@ -19,3 +26,34 @@ command = "cat /home/hulthe/.stld"
symbol = "🕑" symbol = "🕑"
style = "italic bright-purple" style = "italic bright-purple"
format = "[$symbol ($output )]($style)" format = "[$symbol ($output )]($style)"
{% if demo %}
disabled = true
{% end %}
# hide all persondata while in demo mode
{% if demo %}
[directory]
truncation_length = 1
[git_branch]
disabled = true
[git_commit]
disabled = true
[git_state]
disabled = true
[git_status]
disabled = true
[package]
disabled = true
[rust]
disabled = true
[python]
disabled = true
{% end %}