Open
Conversation
Signed-off-by: Balaji J <[email protected]>
Signed-off-by: Balaji J <[email protected]>
Signed-off-by: Balaji J <[email protected]>
Signed-off-by: Balaji J <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes pager behavior/optimization in the CLI output layer and introduces a configurable pager mode (auto|always|never) exposed via the config file.
Changes:
- Add
pagerto the main config schema + default config TOML and validate allowed values. - Update
PgxPrinterto support pager modes and to decide pager usage based on output size/line count. - Extend unit tests for config loading/validation and pager-related printer behavior.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/config/config.go | Adds Pager field to the config struct. |
| internal/config/config.toml | Introduces default pager = "auto" and documents modes. |
| internal/config/validate.go | Validates pager presence and allowed values. |
| internal/config/config_test.go | Asserts pager config is loaded/merged correctly. |
| internal/config/validate_test.go | Adds coverage for empty/invalid pager mode validation on load. |
| internal/cliio/printer.go | Implements pager mode support and pager-use heuristics; refactors pager resolution. |
| internal/cliio/printer_test.go | Adds tests for pager mode parsing, heuristics, and newline handling. |
| internal/cli/root.go | Applies configured pager mode to the printer during CLI initialization. |
| internal/cli/flags.go | Formatting-only change. |
Comments suppressed due to low confidence (1)
internal/cliio/printer.go:197
- tryPipePager creates a StdinPipe before calling cmd.Start(), but if cmd.Start() fails it returns without closing the pipe. This can leak file descriptors in error scenarios. Close stdin when cmd.Start() returns an error (and consider cleaning up similarly for other early returns).
stdin, err := cmd.StdinPipe()
if err != nil {
return false
}
if err := cmd.Start(); err != nil {
return false
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Balaji J <[email protected]>
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.
fix the pager optimization and add config pager mode.