MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / parse_from_output

Function parse_from_output

src/binary_installer/versions.rs:8–17  ·  view source on GitHub ↗

Parse a version string from command output. Expects the output format to be: "command_name version_string" Example: "codspeed-memtrack 4.4.2"

(output: &str)

Source from the content-addressed store, hash-verified

6/// Expects the output format to be: "command_name version_string"
7/// Example: "codspeed-memtrack 4.4.2"
8pub(super) fn parse_from_output(output: &str) -> Result<Version> {
9 let version_str = output
10 .split_once(" ")
11 .context("Unexpected version output format: missing space separator")?
12 .1
13 .trim();
14
15 Version::parse(version_str)
16 .with_context(|| format!("Failed to parse version from: {version_str}"))
17}
18
19/// Check if an installed version is compatible with the expected version.
20///

Callers 3

is_command_installedFunction · 0.85
parses_valid_versionFunction · 0.85

Calls

no outgoing calls

Tested by 2

parses_valid_versionFunction · 0.68