Skip to content

fix(find): support -print flag as no-op - #2265

Closed
youbamj wants to merge 1 commit into
rtk-ai:developfrom
youbamj:fix/find-print-flag
Closed

youbamj wants to merge 1 commit into
rtk-ai:developfrom
youbamj:fix/find-print-flag

Conversation

@youbamj

@youbamj youbamj commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Problem

rtk find . -name "*.rs" -print warns:

rtk find: unknown flag '-print', ignored

The -print flag is the default action in standard find(1). RTK already prints matches, so this should be a no-op.

Root Cause

has_native_find_flags() didn't recognize -print, causing it to fall through to the "unknown flag" warning handler.

Changes

  • Add -print to has_native_find_flags() so RTK enters native parsing mode
  • Add -print case in parse_native_find_args() as a no-op (RTK already prints matches)
  • Add 2 unit tests for -print behavior

Verification

cargo fmt --all --check && cargo clippy --all-targets && cargo test
# 2007 passed, 0 failed

Notes

  • Output format stays as-is (grouped by directory for token savings — intentional RTK behavior)
  • Does NOT add -print0 (which is in UNSUPPORTED_FIND_FLAGS — different semantics)

@rtk-release-bot

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale due to 90 days of inactivity. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. Your contribution is very much appreciated — we're sorry we haven't been able to review it yet.

@rtk-release-bot rtk-release-bot Bot added the stale label Sep 3, 2026
@KuSh

KuSh commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the report and the fix. This is covered on develop by #3603 (merged 2026-08-26), which reworked rtk find to parse find's real grammar; -print is now recognised as a native action and the command runs through to real find, so the 'unknown flag -print, ignored' warning is gone. Running rtk find . -maxdepth 1 -name '*.md' -print against develop produces plain results with no warning, and find_cmd.rs was rewritten enough that this branch no longer applies. Closing as covered, but please comment or reopen if you still see the warning on a case we missed.

@KuSh KuSh closed this Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants