-
Notifications
You must be signed in to change notification settings - Fork 312
Add JSON/YAML output options to namespace list #4719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add JSON/YAML output options to namespace list #4719
Conversation
…in output, and fixed unit tests Signed-off-by: Nacho Fuertes <nacho@okteto.com>
Signed-off-by: Nacho Fuertes <nacho@okteto.com>
Signed-off-by: Nacho Fuertes <nacho@okteto.com>
Tests done: Sample of plain output
Sample with JSON output:
Sample with YAML output:
Output when wrong output option is specified (the same that happens with namespace list command):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds support for JSON/YAML output modes to the okteto namespace list
command, including flag parsing, output formatting, and corresponding unit tests.
- Introduces a new
--output
flag with validation forjson
andyaml
- Implements
displayListNamespaces
andgetNamespaceOutput
to render in table, JSON, or YAML - Adds unit tests for output validation and formatted output cases
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
cmd/namespace/list.go | Add --output flag, validate formats, implement JSON/YAML/table output functions |
cmd/namespace/list_test.go | Update existing test for new signature and add tests for validateNamespaceListOutput and displayListNamespaces |
Comments suppressed due to low confidence (1)
cmd/namespace/list_test.go:78
- Add a test case that calls
executeListNamespaces
with an invalid format (for example, "xml") to assert that it returnserrInvalidOutput
.
err := nsCmd.executeListNamespaces(ctx, "")
Signed-off-by: Nacho Fuertes <nacho@okteto.com>
Closing in favor of #4722 to make the CI pass as CI secrets are not injected on PRs coming from a fork |
Summary
--output
flag forokteto namespace list
Testing
make test
(fails: cannot download modules)