Skip to main content

Module cli_tools

Module cli_tools 

Source
Expand description

CLI tool detection for cli-tool nodes.

The Node Hub asks “is the binary this cli-tool node needs installed, and is it at least the minimum version the entry declares?”. This module answers the first half - it probes the machine by running <name> <version_command> (default --version) and parsing a version token out of the output. The minimum-version verdict is computed by the caller (the frontend) so the probe stays a pure “what’s installed?” query and the command is reusable.

Spawning mirrors the adapters’ tokio::process::Command::new(CLI) pattern, so no extra Tauri plugin or shell capability is required.

Structs§

CliToolStatus
Outcome of probing the machine for one CLI tool. found distinguishes “binary missing from PATH” from “present but version unparseable”. Never surfaced as an Err so the Hub renders a badge instead of failing.

Functions§

detect_cli_tool
Probe for name <version_command>. Returns found: false (never an Err) when the binary can’t be spawned or the name is rejected.
parse_version
Extract the first dotted numeric version token (\d+(\.\d+)+) from text. Bare integers and dash-separated dates (2024-01-02) are skipped so a build date or revision number isn’t mistaken for a version.