detect_from_command

Function detect_from_command 

Source
pub fn detect_from_command(command: &str) -> Option<PackageManager>
Expand description

Infers the package manager from a command string.

Maps common command names to their corresponding package managers.

ยงExamples

use cuenv_workspaces::detection::detect_from_command;
use cuenv_workspaces::PackageManager;

assert_eq!(detect_from_command("cargo"), Some(PackageManager::Cargo));
assert_eq!(detect_from_command("npm"), Some(PackageManager::Npm));
assert_eq!(detect_from_command("bun"), Some(PackageManager::Bun));
assert_eq!(detect_from_command("pnpm"), Some(PackageManager::Pnpm));
assert_eq!(detect_from_command("node"), Some(PackageManager::Npm));
assert_eq!(detect_from_command("unknown"), None);