Skip to content

Run the menu's verbs on the path given with -p instead of asking again [patch] - #184

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/177-menu-keeps-path
Oct 9, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/177-menu-keeps-path

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #177

Summary

Menu is the default verb and inherits -p, --path from BaseVerb, so FileDeduplicator -p ~/Photos with no verb accepted the path. The verbs the menu then built never received it, so choosing Scan asked Enter the path to scan: again.

The issue preferred keeping -p working over removing it, so this PR does that. Each menu entry, numbered or scrolling, is now a small PresetPathCommand that sets the verb's PathString from the menu's path just before Execute(). It is set again on every choice, because BaseVerb<T>.Run sets PathString back to null in its finally. The menu's own PathString stays set for the whole menu loop, since that finally runs only after the loop exits. Without -p, the menu path is null, and each verb asks for a path as it did before.

Tests

  • MenuHandsItsPathToTheChosenVerb: a Menu with PathString set picks Scan twice with no path on stdin. The test asserts there is no Enter the path prompt and that both runs scan the given directory.
  • With the fix reverted, the new test fails. With it applied, the full suite passes (102 passed, 3 skipped).

🤖 Generated with Claude Code

https://claude.ai/code/session_019BwRbgKQMY5pZraxHBjxqM


Generated by Claude Code

…n [patch]

Menu is the default verb and inherits -p, so `FileDeduplicator -p dir`
accepted the path, then every verb built by the menu prompted for it
again. Each menu entry now hands the verb the menu's path before it
runs, re-applied on every choice because BaseVerb<T>.Run clears it.

Fixes #177

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019BwRbgKQMY5pZraxHBjxqM
@sonarqubecloud

sonarqubecloud Bot commented Oct 9, 2026

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit be03445 into main Oct 9, 2026
14 checks passed
@matt-edmondson
matt-edmondson deleted the fix/177-menu-keeps-path branch October 9, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FileDeduplicator -p <dir> with no verb accepts the path, then the menu ignores it and asks for the path again

2 participants