Skip to content

fix(sandbox): parse sync flags placed after the sandbox arg#60

Merged
pratikbin merged 1 commit into
mainfrom
fix/sync-flag-parsing
Jun 30, 2026
Merged

fix(sandbox): parse sync flags placed after the sandbox arg#60
pratikbin merged 1 commit into
mainfrom
fix/sync-flag-parsing

Conversation

@pratikbin

Copy link
Copy Markdown
Contributor

Recovers a dropped fix

PR #59 was squash-merged while GitHub's PR API still pointed at the stale head c7edb2d, so the follow-up fix commit 0247f9e never landed on main. This re-applies it.

What

urfave/cli v2 stops flag parsing at the first positional, so sandbox sync my-box --mode mirror silently dropped every flag after the sandbox argument (the new --exclude/--mode/--quiet/--no-ignore-vcs plus the pre-existing --local/--remote/-i, the latter masked by interactive prompts on a TTY).

  • syncOptions + parseSyncArgs recover flags regardless of position (matches parseDiskCreateArgs/splitForceFlag)
  • pure mutagenCreateArgs so the destructive mirror mapping is unit-tested
  • runMutagen takes output sinks; --quiet captures create output, surfaces it only on failure
  • regression tests (parser before/after positional, mirror mapping, mode mapping)

Verify

go build / go test (6 pass) / golangci-lint v2 (0) / gosec (0). Verified on the real binary: flags after the positional now parse end-to-end.

urfave/cli v2 stops flag parsing at the first positional, so
`sandbox sync my-box --mode mirror` silently dropped every flag after
the sandbox argument — the new --exclude/--mode/--quiet/--no-ignore-vcs
plus the pre-existing --local/--remote/-i (the latter masked by the
interactive prompts on a TTY).

- add syncOptions + parseSyncArgs to recover flags regardless of
  position, matching the parseDiskCreateArgs / splitForceFlag pattern
- extract pure mutagenCreateArgs so the destructive mirror mapping is
  unit-tested
- make runMutagen take output sinks; --quiet now captures sync create
  output and surfaces it only on failure instead of leaking to stderr
- add regression tests for the parser, mirror mapping, and mode mapping

Addresses review feedback on #59.
@pratikbin pratikbin merged commit 9e79d59 into main Jun 30, 2026
1 check passed
@pratikbin pratikbin deleted the fix/sync-flag-parsing branch June 30, 2026 14:11
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