fix: recognize oliver wrap subcommand in parseArgs (#115) - #116
Merged
Merged
Conversation
parseArgs handled render/serialize/scale/menu/meta/plan/manifest
but not wrap, so 'oliver wrap --template ...' returned error.Usage
even though Command.wrap and all wrap flags existed.
Add 'else if (std.mem.eql(u8, arg, "wrap"))' alongside meta/plan
so the subcommand sets command=.wrap. The existing validation and
dispatch already expected .wrap; only the token was missing.
Repro: oliver wrap --template /tmp/t.html --meta-json /tmp/m.json
--assets-root ./assets/ --body /tmp/b.html → usage (exit 1)
Now wraps correctly (html-escaped meta + literal assets/body) and
rejects duplicate/conflicting subcommands like other commands.
Closes #115
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #115
parseArgsinsrc/main.zig:200handledrender/serialize/scale/menu/meta/plan/manifestbut notwrap, sooliver wrap --template /tmp/t.html --meta-json /tmp/m.json --assets-root ./assets/ --body /tmp/b.html # → usage, exit 1 (should wrap)failed with
error.Usageeven thoughCommand.wrap(src/main.zig:52) and all--template/--meta-json/--assets-root/--bodyflag handling existed.Fix: Add
alongside
meta/planin the subcommand dispatch. Existingwrapvalidation (saw_wrap_*+.wrap =>branch) andwrapDispatchalready expected.wrap; only the token was missing.Verification:
zig build→oliver wrapnow wraps (html-escaped meta + literal body/assets)zig build test --summary all→ 453/453 pass (317+18+7+91+19+1)error.Usage(exit 1)oliver wrap --template /tmp/t.html --meta-json /tmp/m.json --assets-root ./assets/ --body /tmp/b.htmlexit 0, title/body substituted