fix: ask for a new path each time a menu verb runs [patch] - #143
Merged
Merged
Conversation
The interactive menu runs one instance of each verb every time its item is chosen, and each verb reset its path only on the last line of Run. An early return (nothing found, no duplicates, a declined confirmation) kept the old path, so the next run skipped the prompt and the path the user typed was read as the answer to the next question instead. BaseVerb<T>.Run now resets the path in a finally block, and the per-verb resets are gone. Fixes #138 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YLYtHwwqdY3Tk9vpkwT6Sw
|
This was referenced Sep 27, 2026
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.



Fixes #138
What changed
The interactive menu keeps one instance of each verb and runs that instance every time its item is chosen. A verb prompts for a path only when
PathStringis".". Before this change, each verb resetPathStringonly on the last line of itsRun. Any early return skipped the reset: no files found, no duplicates, or the user declining the confirmation. The next time that item was chosen, the verb skipped the prompt and ran against the old directory. The path the user typed was then read as the answer to the verb's next prompt; for Deduplicate that is "Proceed with deletion?", which by then targets a directory the user did not choose.BaseVerb<T>.Runnow restoresisActiveand resetsPathStringin afinally. That covers early returns and exceptions. I removed the four per-verbPathString = "."lines, since they are now redundant. On the command line each verb runs once, so behaviour there is unchanged.Tests
New
VerbReuseTestsreuses one verb instance the way the menu does:nat the confirmation, and the files in the first directory are still there.With the
FileDeduplicator/changes reverted, all 5 tests fail. With the fix, the full suite has 51 passes and 0 failures. The other 2 tests are the existing permission-based ones, which report inconclusive when run as root.This PR also touches
Stats.cs, which #142 changes too. The two branches merge cleanly.🤖 Generated with Claude Code
https://claude.ai/code/session_01YLYtHwwqdY3Tk9vpkwT6Sw
Generated by Claude Code