pub fn declared(root: &Path) -> Option<String>Expand description
The version the crate manifest declares: the authority.
The one Rust reader of it. majordomus generate asks the same function when it decides
whether the executable running is the one the tree declares.
use majordomus_cli::release::version::{declared, MANIFEST};
let dir = tempfile::tempdir().unwrap();
// No manifest is no version, never a guess.
assert_eq!(declared(dir.path()), None);
std::fs::create_dir_all(dir.path().join("apps/majordomus-cli")).unwrap();
std::fs::write(dir.path().join(MANIFEST), "[package]\nversion = \"0.9.0\"\n").unwrap();
assert_eq!(declared(dir.path()).as_deref(), Some("0.9.0"));