diff --git a/src/lib.rs b/src/lib.rs index 1206676..2565fcb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -72,6 +72,12 @@ pub fn validate_workspace_path(mut path: PathBuf) -> Result, overwrite: bool, only_check: bool, -) -> Result<(), Box> { +) -> Result> { let cargo_toml = update_dependencies_impl(cargo_toml_path, crates_versions, overwrite, only_check)?; - match cargo_toml { - Some(new_content) => { - fs::write(cargo_toml_path, new_content)?; - println!("Updated dependencies in {}", cargo_toml_path.display()); - } - None => { - println!( - "Dependencies in {} are already up to date", - cargo_toml_path.display() - ); - } - } + let updated = if let Some(new_content) = cargo_toml { + fs::write(cargo_toml_path, new_content)?; + true + } else { + false + }; - Ok(()) + Ok(updated) } /// Internal implementation of dependency update logic. diff --git a/src/main.rs b/src/main.rs index 755f116..1340da7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -86,7 +86,14 @@ async fn main() -> Result<(), Box> { include_orml_crates_in_version_mapping(&mut crates_versions, orml_crates); } - update_dependencies(&cargo_toml_path, &crates_versions, cmd.overwrite, cmd.check)?; + if update_dependencies(&cargo_toml_path, &crates_versions, cmd.overwrite, cmd.check)? { + println!("Updated dependencies in {}", cargo_toml_path.display()); + } else { + println!( + "Dependencies in {} are already up to date", + cargo_toml_path.display() + ); + } Ok(()) }