nestrs-cli-rs 0.1.0

Rust port of the Nest CLI for the nestrs organization.
Documentation
//! Upstream source: `../nest-cli/lib/utils/local-binaries.ts`.

use std::path::PathBuf;

pub fn local_bin_path() -> PathBuf {
    std::env::current_dir()
        .unwrap_or_else(|_| PathBuf::from("."))
        .join("node_modules")
        .join("@nestjs")
        .join("cli")
}

pub fn local_bin_exists() -> bool {
    local_bin_path().exists()
}

/// Returns the local CLI `commands` module path that upstream would require.
pub fn load_local_bin_command_loader() -> Option<PathBuf> {
    let commands_file = local_bin_path().join("commands");
    if commands_file.exists() {
        Some(commands_file)
    } else {
        None
    }
}