()
| 509 | /// Get version from Cargo.toml |
| 510 | #[context("Querying package version")] |
| 511 | fn get_package_version() -> Result<String> { |
| 512 | let cargo_toml = |
| 513 | fs::read_to_string("crates/lib/Cargo.toml").context("Reading crates/lib/Cargo.toml")?; |
| 514 | |
| 515 | let parsed: toml::Table = cargo_toml.parse().context("Parsing Cargo.toml")?; |
| 516 | |
| 517 | let version = parsed |
| 518 | .get("package") |
| 519 | .and_then(|p| p.as_table()) |
| 520 | .and_then(|p| p.get("version")) |
| 521 | .and_then(|v| v.as_str()) |
| 522 | .ok_or_else(|| anyhow::anyhow!("Could not find package.version in Cargo.toml"))?; |
| 523 | |
| 524 | Ok(format!("v{}", version)) |
| 525 | } |
| 526 | |
| 527 | /// Single command to update all man pages - auto-discover new commands and sync existing ones |
| 528 | pub fn update_manpages(sh: &Shell) -> Result<()> { |
no test coverage detected