duck-template 0.1.7

A cli tool for generating files from a template just with a json file
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
mod __test__;
pub enum LogLevel {
  Error,
  Warning,
  Success,
  Info,
}

pub fn log(level: LogLevel, message: &str) {
  let (prefix, color) = match level {
    LogLevel::Error => ("[ERROR]", "\x1b[31m"),  // Red
    LogLevel::Warning => ("[WARN]", "\x1b[33m"), // Yellow
    LogLevel::Success => ("[OK]", "\x1b[32m"),   // Green
    LogLevel::Info => ("[INFO]", "\x1b[34m"),    // Blue
  };

  println!("{}{} {}\x1b[0m", color, prefix, message);
}