Repository navigation
fix(cli): name the global --fields in the overflow note of generated commands - #219
Merged
Merged
Conversation
…commands The structured-output overflow note and error only named flags a command declared via declareOutputNarrowing, and generated commands declare none, so they claimed no flag narrows the output even though the global --fields projects every structured record they print. declaredNarrowing now derives the projection flag for a command whose --fields is the root's global flag, identified by flag identity rather than name, so a command defining its own --fields (monit rule-update-fields, a write selector) still gets no advice unless it declares one. A rows flag is still offered only where a command declares it: the spec does not say whether a generated command's --limit bounds the rows.
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.
Problem
When a structured list overflows the 16384-byte budget, the note and the irreducible-overflow error say "this command declares no flag that narrows the output" for every generated command, although the global
--fieldsprojects their output (projection runs before bounding, so--fieldsdoes return the full page).Change
declaredNarrowingderives the projection flag for a command whose--fieldsis the root's persistent flag (compared by flag identity, not name). One rule covers every generated command; no per-command declarations.--fieldsshadows the global flag and still names it only if it declares it, somonit rule-update-fields(a write selector) is not misdirected.--limitbounds the rows (some ignore it), so the generator keeps emitting no rows declaration; its comment is updated.Tests
Generated-verb tests now assert the note and error name
--fieldsand never--limit; a new table test covers inherited, shadowed, declared and absent--fields.make fmt,make lint(0 issues),go test ./...,make check-cards,make buildpass. Generated files are unchanged.