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)
| 6 | /// Expects the output format to be: "command_name version_string" |
| 7 | /// Example: "codspeed-memtrack 4.4.2" |
| 8 | pub(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 | /// |
no outgoing calls