INNER CODE UNIT · Rust

format_header

xajik/thedeck · scripts/thedeck-helper/src/main.rs:51

fn format_header() -> String {
    let year_today = Utc::now().format("%Y").to_string();
    let date_today = Utc::now().format("%Y-%m-%d").to_string();
    return include_str!("../templates/header")
        .replace("{date_today}", date_today.as_str())
        .replace("{year_today}", year_today.as_str());
}

fn read_user_input(prompt: &str) -> Result<String, io::Error> {
    print!("{}", prompt);
    io::stdout().flush()?;

    let mut input = String::new();
    io::stdin().read_line(&mut input)?;

    Ok(input.trim().to_owned())
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…