pub trait Toolbox {
// Required methods
fn on_path(&self, tool: &str) -> Option<PathBuf>;
fn in_dir(&self, dir: &Path, tool: &str) -> Option<PathBuf>;
fn version(&self, path: &Path) -> Option<Version>;
fn npx_available(&self) -> bool;
}Expand description
Abstraction over the host so detection is testable. The real implementation
is SystemToolbox; tests supply a deterministic fake.
Required Methods§
Sourcefn on_path(&self, tool: &str) -> Option<PathBuf>
fn on_path(&self, tool: &str) -> Option<PathBuf>
Resolve tool on the global PATH (with PATHEXT semantics).
Sourcefn in_dir(&self, dir: &Path, tool: &str) -> Option<PathBuf>
fn in_dir(&self, dir: &Path, tool: &str) -> Option<PathBuf>
Resolve tool inside a specific directory (a node_modules/.bin).
Sourcefn version(&self, path: &Path) -> Option<Version>
fn version(&self, path: &Path) -> Option<Version>
Run <path> --version and parse the first version it prints.
Sourcefn npx_available(&self) -> bool
fn npx_available(&self) -> bool
Is npx itself available to provision packages on demand?