Skip to content

fix: pass dash-looking operands after -- - #256

Merged
SebTardif merged 1 commit into
mainfrom
fix/improve-mpi-20260828-s1352
Aug 28, 2026
Merged

fix: pass dash-looking operands after --#256
SebTardif merged 1 commit into
mainfrom
fix/improve-mpi-20260828-s1352

Conversation

@SebTardif

Copy link
Copy Markdown
Contributor

Summary

Stop clap from treating Quick Action operands such as --apply as flags.

Why

After #255, the extension no longer scans argv for flag names. The Patchloom CLI still does. A replace of the text --apply was serialized as:

patchloom --contain replace --apply --new X file --apply

Live probe on patchloom 0.28.0: the argument '--apply' cannot be used multiple times. Search with pattern --apply failed with unexpected argument '--apply'. Doc set with selector --apply failed the same way.

Clap's own hint is: pass -- --apply as a value.

The change

  • withEndOfOptions(head, operands) emits options, then --, then positionals.
  • Replace, insert-after/before, search, and doc set/get/update/delete/delete-where/append/prepend/ensure/move use that shape.
  • serializePatchloomArgs inserts --apply before -- so the apply flag is not swallowed as a path.

Working form (live-probed):

patchloom --contain replace --new X --apply -- --apply file

Verification

  • Live patchloom probe: old argv fails; -- form replaces --apply and --contain in file text.
  • npm test 430 passed, 7 skipped.
  • Coverage threshold and vsce package passed.

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)

Clap treats a positional --apply as the apply flag. Replace, search,
and doc Quick Actions then fail with "cannot be used multiple times"
or unexpected argument. Put options first, then --, then operands.
serializePatchloomArgs inserts --apply before --.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
@SebTardif
SebTardif marked this pull request as ready for review August 28, 2026 21:01
@SebTardif
SebTardif merged commit 2c2973a into main Aug 28, 2026
21 checks passed
@SebTardif
SebTardif deleted the fix/improve-mpi-20260828-s1352 branch August 28, 2026 21:01
SebTardif added a commit that referenced this pull request Aug 28, 2026
* fix: put remaining Quick Action paths after --

Create, append, prepend, tidy, apply-fragment, md, patch, and doc
merge still put the file path before options. A path of --apply
made clap treat it as the apply flag. Same -- terminator as #256.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>

* fix: pass Quick Action option values as --flag=value

Clap treats a following `--` or `-n` as end-of-options or another
flag, so create/replace content starting with a dash failed. Bind
user option values with equals form.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>

---------

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
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