(
path: PathBuf,
run_modifiers: Vec<String>,
)
| 77 | } |
| 78 | |
| 79 | fn get_zig_version( |
| 80 | path: PathBuf, |
| 81 | run_modifiers: Vec<String>, |
| 82 | ) -> std::result::Result<ZigInfo, miette::Error> { |
| 83 | let mut cmd = Command::new(&path); |
| 84 | cmd.args(&run_modifiers); |
| 85 | cmd.arg("version"); |
| 86 | let output = cmd.output().into_diagnostic()?; |
| 87 | let version = String::from_utf8(output.stdout) |
| 88 | .into_diagnostic()? |
| 89 | .trim() |
| 90 | .to_string(); |
| 91 | |
| 92 | let mut command = format!("{}", path.display()); |
| 93 | if !run_modifiers.is_empty() { |
| 94 | command.push(' '); |
| 95 | command.push_str(&run_modifiers.join(" ")); |
| 96 | }; |
| 97 | |
| 98 | Ok(ZigInfo { |
| 99 | command: Some(command), |
| 100 | version: Some(version), |
| 101 | ..Default::default() |
| 102 | }) |
| 103 | } |
| 104 | |
| 105 | #[derive(Clone, Debug)] |
| 106 | pub enum InstallOption { |
no test coverage detected