aoc-toolkit 0.1.0-alpha.2

A toolkit for solving Advent of Code problems
Documentation
use std::io;
use std::path::PathBuf;

use thiserror::Error;

#[derive(Debug, Error)]
pub enum ScaffoldError {
    #[error("Invalid relative path: {0:?}")]
    InvalidPath(PathBuf),

    #[error("File already exists: {0:?}")]
    FileExists(PathBuf),

    #[error("Conflicting planned path: {0:?}")]
    PathConflict(PathBuf),

    #[error("Expected a directory: {0:?}")]
    NotDirectory(PathBuf),

    #[error("Symbolic links are not supported: {0:?}")]
    SymbolicLink(PathBuf),

    #[error("Filesystem operation failed for {path:?}: {source}")]
    Io {
        path: PathBuf,
        #[source]
        source: io::Error,
    },

    #[error(transparent)]
    Template(#[from] minijinja::Error),

    #[error("File does not exist: {0:?}")]
    FileNotFound(PathBuf),

    #[error("Expected a regular file: {0:?}")]
    NotFile(PathBuf),

    #[error("File changed since the scaffold plan was created: {0:?}")]
    FileChanged(PathBuf),

    #[error("Unsupported or modified managed file: {0:?}")]
    InvalidManagedFile(PathBuf),

    #[error("Invalid year directory prefix: {0:?}")]
    InvalidYearPrefix(String),

    #[error("Day {day} of year {year} is already registered")]
    DayAlreadyRegistered { year: usize, day: usize },
}