mecha10-cli 0.1.47

Mecha10 CLI tool
Documentation
//! Validation logic for project initialization
//!
//! Provides validation functions for project paths.

use anyhow::{anyhow, Result};
use std::path::Path;

/// Check if a directory already exists
///
/// # Arguments
///
/// * `path` - Path to check
///
/// # Returns
///
/// Ok(()) if path doesn't exist, Err if it exists
pub fn check_directory_not_exists(path: &Path) -> Result<()> {
    if path.exists() {
        return Err(anyhow!(
            "Directory '{}' already exists.\n\
             Please choose a different project name or remove the existing directory.",
            path.display()
        ));
    }
    Ok(())
}