feat: add 'cat' command for displaying package resources#4505
feat: add 'cat' command for displaying package resources#4505aravindtga wants to merge 4 commits intokptdev:mainfrom
Conversation
✅ Deploy Preview for kptdocs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
Restores the kpt pkg cat subcommand (previously removed in #2393) to print package resources, with additional correctness behavior around rejecting non-resource file arguments and improved test coverage for edge cases.
Changes:
- Reintroduce
thirdparty/cmdconfig/commands/cmdcatimplementation and hook it intokpt pkg. - Add comprehensive unit tests covering directory traversal, nested packages, annotation behavior, formatting/comment stripping, and error cases.
- Change behavior for non-YAML/JSON file arguments to return an error and non-zero exit.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| thirdparty/cmdconfig/commands/cmdcat/cmdcat.go | Restores the cat command implementation and adds stricter file-argument validation and contextual error diagnostics. |
| thirdparty/cmdconfig/commands/cmdcat/cmdcat_test.go | Adds tests covering core output behavior and multiple historical issues/edge cases. |
| commands/pkg/pkgcmd.go | Wires the restored cat command into the pkg command group. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4c2c2f0 to
32434ae
Compare
There was a problem hiding this comment.
Pull request overview
Restores the kpt pkg cat subcommand (previously removed in #2393) to print KRM resources from a file or package directory, along with a focused test suite to validate output formatting, annotation behavior, recursion behavior, and error cases.
Changes:
- Reintroduce
cmdcatCobra command implementation and package traversal wiring. - Add comprehensive unit tests covering directory/file inputs, annotation behavior, recursion, and failure modes.
- Wire
pkg catinto thekpt pkgcommand group.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| thirdparty/cmdconfig/commands/cmdcat/cmdcat.go | Implements the restored pkg cat command, including flag handling, package traversal, and output formatting. |
| thirdparty/cmdconfig/commands/cmdcat/cmdcat_test.go | Adds test coverage for core behaviors and key regressions/edge cases. |
| commands/pkg/pkgcmd.go | Registers pkg cat under the existing kpt pkg command group. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech>
Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech>
Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech>
Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech>
32434ae to
145d498
Compare
Restores the cat subcommand under pkg that was removed in #2393 (#2393), with small correctness and testability fixes on top.
Changes
thirdparty/cmdconfig/commands/cmdcat/cmdcat.goand wire it into pkg.Test
AI usage disclosure