Repository navigation
fix: make --version output consistent across utilities - #838
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #838 +/- ##
==========================================
+ Coverage 91.93% 91.96% +0.03%
==========================================
Files 35 35
Lines 7253 7258 +5
Branches 378 378
==========================================
+ Hits 6668 6675 +7
+ Misses 443 441 -2
Partials 142 142 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR aims to standardize --version output across the findutils Rust utilities so each tool prints just <util> <version> without extra prefixes or error wrappers.
Changes:
- Adjust
find --versionoutput to remove the(Rust)suffix. - Change
updatedbargument parsing so--versionno longer shows up as an error-prefixed message.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/updatedb/mod.rs | Changes clap parsing behavior to avoid error-wrapped --version output (but currently exits the process on parse errors). |
| src/find/mod.rs | Updates --version formatting to find <version> for consistency. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Commit 077eb5a has test result changes: bfs testsuite: |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (2)
src/find/mod.rs:413
- The updated version string format for
find --versionisn’t covered by tests, so regressions (e.g., reintroducing the "(Rust)" suffix) would be easy to miss. Consider adding an integration test that runsfind --versionand asserts stdout matches^find \d+\.\d+\.\d+\s*$and stderr is empty.
fn print_version(deps: &dyn Dependencies) -> Result<(), io::Error> {
writeln!(
&mut deps.get_output().borrow_mut(),
"find {}",
env!("CARGO_PKG_VERSION")
)
src/updatedb/mod.rs:276
- The new
--version/--helphandling relies on special-casing Clap’sDisplayHelp/DisplayVersionerrors to avoid returning an error (and therefore printingError:inupdatedb_main). There’s currently no test ensuringupdatedb --versionexits successfully and prints onlyupdatedb <version>on stdout with noError:prefix on stderr; adding one would prevent regressions.
let matches = match uu_app().try_get_matches_from(args) {
Ok(m) => m,
Err(e) => match e.kind() {
clap::error::ErrorKind::DisplayHelp | clap::error::ErrorKind::DisplayVersion => {
print!("{e}");
return Ok(());
}
_ => return Err(uucore::error::UClapError::with_exit_code(e, 1).into()),
},
|
Commit ff3d8c3 has test result changes: bfs testsuite: |
|
Please add a test to make sure we don't regress in the future |
|
Commit 37be5c0 has test result changes: bfs testsuite: |
|
@sylvestre Done! |
Fixes #837.
Problem
The
--versionoutput is inconsistent across utilities.Updated behavior: