8000 Fixes #4714. Added output option to namespace list command to specify json or yaml by ifbyol · Pull Request #4722 · okteto/okteto · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fixes #4714. Added output option to namespace list command to specify json or yaml #4722

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

Merged
merged 4 commits into from
May 28, 2025

Conversation

ifbyol
Copy link
Member
@ifbyol ifbyol commented May 23, 2025

Proposed changes

Fixes #4714

Added an output option in the namespace list command analogous to the one we have in preview list command. Possible values are json or yaml, and it changes the output accordingly

How to validate

Connect with an Okteto instance and run okteto namespace list with the CLI built from this branch to verify that the expected output is returned. If no output is specified, we return the plain output as we were doing until now

Samples of outputs:

> ok namespace list 
Namespace   Status
ifbyol *    Sleeping
jlopezbarb  Sleeping
> ok namespace list --output json
[
 {
  "namespace": "ifbyol",
  "status": "Sleeping",
  "current": true
 },
 {
  "namespace": "jlopezbarb",
  "status": "Sleeping",
  "current": false
 }
]
ok namespace list --output yaml
- namespace: ifbyol
  status: Sleeping
  current: true
- namespace: jlopezbarb
  status: Sleeping
  current: false
ok namespace list --output yam
 x  Output format is not accepted. Value must be one of: ['json', 'yaml']

ifbyol added 2 commits May 23, 2025 09:59
… json or yaml

Signed-off-by: Nacho Fuertes <nacho@okteto.com>
Signed-off-by: Nacho Fuertes <nacho@okteto.com>
@ifbyol ifbyol requested a review from a team as a code owner May 23, 2025 09:14
Copy link
codecov bot commented May 23, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 42 lines in your changes missing coverage. Please review.

Project coverage is 48.83%. Comparing base (71efd0b) to head (60016a1).
Report is 1 commits behind head on master.

❌ Your patch status has failed because the patch coverage (50.00%) is below the target coverage (60.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4722      +/-   ##
==========================================
+ Coverage   48.80%   48.83%   +0.02%     
==========================================
  Files         354      354              
  Lines       29638    29683      +45     
==========================================
+ Hits        14466    14496      +30     
- Misses      14019    14030      +11     
- Partials     1153     1157       +4     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

switch output {
case "json":
if len(namespaces) == 0 {
fmt.Println("[]")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Should we use our own implementation of ioCtrl?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did it in the last commit. I have to add a lot of changes to leave all the namespace commands ready to use the io.Controller: 60016a1

ifbyol added 2 commits May 26, 2025 15:42
…e-list-output-option

Signed-off-by: Nacho Fuertes <nacho@okteto.com>
Signed-off-by: Nacho Fuertes <nacho@okteto.com>
@ifbyol ifbyol added the run-e2e When used on a PR run windows & unix e2e label May 26, 2025
@ifbyol ifbyol requested a review from jLopezbarb May 26, 2025 14:49
@ifbyol ifbyol merged commit 9a5fcc1 into master May 28, 2025
28 of 29 checks passed
@ifbyol ifbyol deleted the ifbyol/add-namespace-list-output-option branch May 28, 2025 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release/new-feature run-e2e When used on a PR run windows & unix e2e
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Okteto namespace list outputting options
2 participants
0