Show a helpful message when all CLI paths are excluded#93
Open
Show a helpful message when all CLI paths are excluded#93
Conversation
d5d1ebf to
951cded
Compare
When every path passed on the command line matches an exclude rule, precious now exits cleanly with the message "All paths given on the command line were excluded" rather than returning an error. Fixes #92. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
951cded to
79d8d8f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #92.
When every path passed on the command line is matched by an exclude rule, precious previously returned a hard error (
Found some paths when looking for ... but they were all excluded). This was unhelpful — the user had no indication it was safe to ignore.This PR changes the behavior: precious now exits 0 and prints:
This is distinct from the existing "No files found" message used when git modes return zero files, so the user knows specifically why nothing ran.
Implementation
precious-core/src/precious.rs, theFinderError::AllPathsWereExcludederror is now caught explicitly inrun_all_commandsand converted to a clean exit with the new message, rather than propagating as an error.FinderError::AllPathsWereExcludedis retained infinder.rs— it remains the right signal from the finder layer.Tests
precious-core/src/paths/finder.rs):cli_mode_given_dir_all_excluded— verifies the finder still returnsAllPathsWereExcludedwhen all CLI paths are excluded.precious-integration/src/lint_tidy.rs):cli_paths_all_excluded— runs the binary with a fully-excluded path and asserts exit 0 and the expected message in stdout.