aoc-toolkit 0.1.0-alpha.4

A toolkit for solving Advent of Code problems
Documentation
use std::path::{Path, PathBuf};

use crate::application::init::InitReport;
use crate::application::new::NewReport;

pub(crate) fn print_init_report(report: &InitReport) {
    println!("✓ Initialized project {}", report.package_name);
    println!("  Location: {}", report.root.display());

    print_files(&report.root, &report.created_files, "Created files", "+");
}

pub(crate) fn print_new_report(report: &NewReport) {
    println!("✓ Created solver for {} day {}", report.year, report.day);

    print_files(&report.root, &report.created_files, "Created files", "+");

    print_files(&report.root, &report.updated_files, "Updated files", "~");
}

fn print_files(root: &Path, files: &[PathBuf], title: &str, marker: &str) {
    if files.is_empty() {
        return;
    }

    println!();
    println!("{title}:");

    for file in files {
        let relative = file.strip_prefix(root).unwrap_or(file);

        println!("  {marker} {}", relative.display());
    }
}