use std::path::Path;

use super::{Command, usage_error};

pub(super) fn parse_validate_command(
    args: &[String],
    current_dir: &Path,
) -> Result<Command, Box<dyn std::error::Error>> {
    match args {
        [] => Ok(Command::Validate {
            repo_root: current_dir.to_path_buf(),
        }),
        [repo_root] => Ok(Command::Validate {
            repo_root: repo_root.into(),
        }),
        _ => usage_error(),
    }
}
