Skip to content

Add --rename-only and --content-only scope flags #36

@dolph

Description

@dolph

Problem

Today find-replace always does both:

  1. Rewrites file contents containing the pattern
  2. Renames files and directories whose names contain the pattern

There's no way to scope to just one half. Users hit this when:

  • Refactoring import paths where the filename happens to contain the same string but shouldn't be renamed (--content-only)
  • Reorganizing files by naming convention without touching contents (--rename-only)
  • Auditing the impact of one half before running the other

Proposed change

Add two mutually exclusive flags:

  • --content-only — rewrite file contents; do not rename any files or directories
  • --rename-only — rename files and directories; do not rewrite any contents

Default behavior is unchanged (both happen). Passing both flags is an error.

Acceptance

  • --content-only skips the rename phase entirely
  • --rename-only skips the content-rewrite phase entirely
  • Passing both flags exits non-zero with a clear message
  • Default behavior (neither flag) is unchanged
  • README updated with examples for each
  • Tests cover all three combinations on a tree containing both matching contents and matching names

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions