feat: add print appendix presets#45
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces intent-based print presets for scalar appendix output (basic, enhanced, full, none) and wires them into the existing print-section parsing used by both the public reference API and the rendertree --print CLI flag, while preserving the nil-vs-explicit-empty RenderConfig.PrintSections semantics via a new helper.
Changes:
- Add preset names/types and parsing for scalar appendix printing, and allow
ParsePrintSectionsto accept presets in addition to comma-separated section names. - Add
reference.NewPrintSectionsto make it easy for config bridges to preserve explicit-empty vs default (nil) behavior. - Update tests and CLI/README documentation to cover and describe presets and explicit empty parsing.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
plantree/reference/reference.go |
Documents how to map preset names into RenderConfig.PrintSections while preserving nil vs explicit-empty semantics. |
plantree/reference/reference_test.go |
Extends parsing tests for presets and enforces non-nil empty slices for explicit empty/preset none; adopts NewPrintSections in config tests. |
plantree/reference/appendix.go |
Exposes PrintPreset, ParsePrintPreset, PrintPreset.Sections, and NewPrintSections; updates ParsePrintSections behavior/docs. |
internal/scalarappendix/appendix.go |
Implements preset parsing/expansion and updates section-list parsing to accept presets. |
internal/scalarappendix/appendix_test.go |
Adds test cases for preset parsing and explicit-empty non-nil behavior. |
cmd/rendertree/README.md |
Documents presets and the --print="" explicit-empty behavior. |
cmd/rendertree/impl/impl.go |
Updates --print flag help text to mention presets. |
cmd/rendertree/impl/impl_test.go |
Adds preset test cases for CLI print-section parsing and enforces non-nil explicit-empty behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request introduces intent-based presets (basic, enhanced, full, none) for the --print flag in rendertree, simplifying how users select appendix sections. The changes include new Preset types and parsing logic in internal/scalarappendix and plantree/reference, along with updated documentation and tests. Feedback focuses on improving the robustness of the ParseSections parser by consistently handling trimmed input and clarifying the documentation for NewPrintSections to better guide API consumers on error handling and variadic usage.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces intent-based presets (basic, enhanced, full, none) for the --print flag, simplifying how users select appendix sections in rendertree. The changes include new Preset types, parsing logic, and updated documentation and tests. Feedback suggests improving the robustness of the ParseSections logic to allow mixing presets with individual sections in comma-separated lists. Additionally, it is recommended to ensure all parsing paths pass through the final validation step and to provide better CLI usage guidance when logical errors occur.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces intent-based presets (basic, enhanced, full, none) for the --print flag in rendertree, simplifying how users select appendix sections. It includes updates to the CLI implementation, internal parsing logic, public API in plantree/reference, and comprehensive test coverage. The documentation has also been updated to reflect these changes and clarify that presets cannot be combined with individual section lists. I have no feedback to provide.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces intent-based presets—basic, enhanced, full, and none—to the rendertree appendix output, simplifying how users select groups of scalar links and sections. The changes include new parsing logic in the internal/scalarappendix and plantree/reference packages, updated CLI flag defaults, and expanded documentation and test coverage. Review feedback recommends refining the parser to treat empty input strings as an explicit empty state and using the %q verb in error messages to improve clarity and consistency with the existing codebase.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces intent-based presets (basic, enhanced, full, none) for the --print flag, simplifying the selection of appendix sections in rendertree. The changes include updated parsing logic in the scalarappendix and plantree packages to handle these presets and prevent them from being mixed with individual section lists. Feedback from the review focused on improving documentation clarity to explicitly mention that blank input strings are treated as empty lists, ensuring the documentation accurately reflects the implementation's behavior.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces intent-based presets (basic, enhanced, full, none) for the --print flag in rendertree, simplifying the selection of appendix sections. The changes include updates to the documentation, CLI flag defaults, and internal parsing logic in internal/scalarappendix and plantree/reference to support these presets and prevent their combination with individual section lists. Additionally, the PR includes comprehensive test coverage for the new functionality. I have no feedback to provide.
Summary
basic,enhanced,full, andnone.ParsePrintSectionsandrendertree --printaccept those presets while preserving comma-separated low-level section names.reference.NewPrintSectionsso config bridges can preserve the nil/default versus explicit-empty distinction forRenderConfig.PrintSections.cmd/rendertree/README.md.Issue handling
Verification
go test ./internal/scalarappendix ./plantree/reference ./cmd/rendertree/implgo test ./...mise x -- golangci-lint run --timeout=5mgit diff --checkreview-router:copilot-gpt-5.4,gemini-3.1-pro-preview,codex-gpt-5.4