started colorizing outputs

This commit is contained in:
Valerie Wolfe 2023-08-16 12:15:25 -04:00
parent e27d218d2e
commit 04cf74161c

View file

@ -6,12 +6,16 @@ use std::{
path::Path
};
use toml::{ map::Map, Value };
use tera::{ Context, Tera };
use termion::{
color::{ self, Fg },
style
};
use toml::{ map::Map, Value };
pub fn apply(targets: &Vec<Map<String, Value>>) {
let home = var("HOME").unwrap();
println!("running apply:");
println!("{}running apply{}", style::Bold, style::Reset);
for target in targets {
// get path and name
let path = target.get("path");
@ -48,13 +52,13 @@ pub fn apply(targets: &Vec<Map<String, Value>>) {
pub fn build(targets: &Vec<Map<String, Value>>, tera: &mut Tera, context: &Context) {
let home = var("HOME").unwrap();
println!("running build:");
println!("{}running build{}", style::Bold, style::Reset);
for target in targets {
// get name property
let i_name = target.get("name");
// handle empty names gracefully
if i_name.is_none() {
println!(" target missing name; skipping");
println!(" {}target missing name; skipping{}", Fg(color::Yellow), Fg(color::Reset));
continue;
}