Repository navigation
Fail generate when --generator has no name, and accept --generator=Name [patch] - #268
Merged
Merged
Conversation
…me [patch] GetOption only recognised `--generator Name` as two tokens. With the option last, or written `--generator=Name`, it returned null, which Generate reads as "no filter", so every generator ran and the command exited 0. Read the filter before loading anything: a bare `--generator`, one followed by another option, or an empty `--generator=` now fails with "'--generator' needs a code generator name." and writes nothing, and `--generator=Name` selects that generator. Fixes #259 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019FkGdWB8Ko3mTn9JiBH973
|
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.



Fixes #259
What changed
GetOptiononly recognised--generatorwhen its value came as a separate token. In two cases it returnednull, whichGeneratereads as "no filter":--generator=NameEither way, every generator ran and the command exited 0.
Generatenow reads the filter throughTryGetGeneratorFilterbefore it loads the schema or writes anything:--generatorwith no value, followed by another option (--generator --verbose), or written as an empty--generator=→'--generator' needs a code generator name., exitFailure, nothing written.--generator=Name→ selects that generator, as the triage comment recommended.--generator Namebehaves as before.FindSchemaPathalready steps over--generator=Nameas a single token, so it needed no change. Rejecting unknown options was optional in the issue and is left out.Tests
TestGeneratorOptionWithoutANameFailsAndWritesNothing(three data rows:--generator,--generator=,--generator --verbose) checks forFailure, the error text, and that noout/directory is created.TestGeneratorOptionAcceptsTheEqualsForm:--generator=CSharpwritesItem.g.cs, and--generator=Cppfails with "no code generator named 'Cpp'".--generatortests still pass.dotnet test Schema.Test: 514/514 passing locally.🤖 Generated with Claude Code
https://claude.ai/code/session_019FkGdWB8Ko3mTn9JiBH973
Generated by Claude Code