Skip to main content

aoc_toolkit/cli/output/
scaffold.rs

1use std::path::{Path, PathBuf};
2
3use crate::application::init::InitReport;
4use crate::application::new::NewReport;
5
6pub(crate) fn print_init_report(report: &InitReport) {
7    println!("✓ Initialized project {}", report.package_name);
8    println!("  Location: {}", report.root.display());
9
10    print_files(&report.root, &report.created_files, "Created files", "+");
11}
12
13pub(crate) fn print_new_report(report: &NewReport) {
14    println!("✓ Created solver for {} day {}", report.year, report.day);
15
16    print_files(&report.root, &report.created_files, "Created files", "+");
17
18    print_files(&report.root, &report.updated_files, "Updated files", "~");
19}
20
21fn print_files(root: &Path, files: &[PathBuf], title: &str, marker: &str) {
22    if files.is_empty() {
23        return;
24    }
25
26    println!();
27    println!("{title}:");
28
29    for file in files {
30        let relative = file.strip_prefix(root).unwrap_or(file);
31
32        println!("  {marker} {}", relative.display());
33    }
34}