Skip to content

refactor: serialize --apply and --contain from flags - #255

Merged
SebTardif merged 1 commit into
mainfrom
refactor/serialize-cli-flags-s1404
Aug 28, 2026
Merged

refactor: serialize --apply and --contain from flags#255
SebTardif merged 1 commit into
mainfrom
refactor/serialize-cli-flags-s1404

Conversation

@SebTardif

Copy link
Copy Markdown
Contributor

Summary

Build Patchloom argv from structured flags instead of scanning a flat string[] for --apply and --contain.

Why

PR #254 stopped Array.includes from treating user text as a flag. That was still argv surgery: helpers looked at token slots in the same array that holds replace/search text.

The extension is not a CLI parser. It should not search operands for option names.

The change

  • PatchloomInvocation carries args, apply, and contain.
  • serializePatchloomArgs prefixes --contain and appends --apply from those booleans only.
  • Builders that write (create, undo, patch apply, patch merge) set apply: true and no longer put --apply in args.
  • executePatchloom serializes at execFile.
  • Batch Apply uses the same serializer.

This does not add commander/yargs. It also does not change how clap sees a positional that looks like a flag (for example replace old text --apply). That would need a named operand on the CLI.

Verification

  • npm run check passed (429 unit tests, 7 skipped, coverage, package).

Checklist

  • All commits in this pull request are signed off with git commit -s
  • I ran npm run check and it passes
  • I updated docs if user-facing behavior changed
  • I am contributing this work under the repository license (MIT)

Quick Action builders kept operands in a string array, then later
helpers scanned that array for flag names. User text equal to
--apply or --contain looked like a flag. Put apply/contain on
PatchloomInvocation and write argv only in serializePatchloomArgs.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
@SebTardif
SebTardif marked this pull request as ready for review August 28, 2026 20:32
@SebTardif
SebTardif merged commit 6267dc2 into main Aug 28, 2026
21 checks passed
@SebTardif
SebTardif deleted the refactor/serialize-cli-flags-s1404 branch August 28, 2026 20:32
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.

1 participant