knave 0.11.0

A small Lisp for humans and agents that infers types and ownership and compiles to readable Rust
Documentation
use std::path::PathBuf;

use super::exit_status::ExitStatus;
use super::located_program::LocatedProgram;
use super::terminal::Terminal;

pub struct CheckCommand {
    file: Option<PathBuf>,
}

impl CheckCommand {
    pub fn new(file: Option<PathBuf>) -> Self {
        Self { file }
    }

    pub fn run(self, terminal: &mut Terminal) -> ExitStatus {
        match LocatedProgram::locate(self.file, terminal)
            .and_then(|program| terminal.check(program.file()))
        {
            Ok(_) => ExitStatus::Success,
            Err(status) => status,
        }
    }
}