[PR #704] [MERGED] Feature/extend client status cmd to print json or yaml #12895

Closed
opened 2026-08-05 02:06:56 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/704
Author: @pascal-fischer
Created: 2/24/2023
Status: Merged
Merged: 2/28/2023
Merged by: @pascal-fischer

Base: mainHead: feature/extend-client-status-cmd-to-print-json-or-yaml


📝 Commits (10+)

  • e75535d Refactor status functions and add first tests
  • 78c6231 Added Output struct to properly name json and yaml attr's and add missing tests
  • f36869e use yaml v3
  • 014f1b8 fix indention in test for yaml output
  • 6539b59 fix indention in test for detail output
  • 8276e09 clean go.mod
  • 0350faf return empty strings for not applicable values
  • a0f2b5f fix codacy
  • 5782496 fix codacy
  • 4330bfd Merge branch 'main' into feature/extend-client-status-cmd-to-print-json-or-yaml

📊 Changes

3 files changed (+594 additions, -178 deletions)

View changed files

📝 client/cmd/status.go (+292 -177)
client/cmd/status_test.go (+301 -0)
📝 go.mod (+1 -1)

📄 Description

Describe your changes

Added cmd flags for the status command in the client to report in json or yaml format.

Refactored existing code to allow reuse for other formats.
Switched to using separate output struct for better sorting and naming of fields in the output string without changing the internally used structs.

Example outputs:

netbird status --detail
detail.txt

netbird status --json
json.txt

netbird status --yaml
yaml.txt

The flags --detail, --json, --yaml and --ipv4 are set to mutually exclusive.

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/704 **Author:** [@pascal-fischer](https://github.com/pascal-fischer) **Created:** 2/24/2023 **Status:** ✅ Merged **Merged:** 2/28/2023 **Merged by:** [@pascal-fischer](https://github.com/pascal-fischer) **Base:** `main` ← **Head:** `feature/extend-client-status-cmd-to-print-json-or-yaml` --- ### 📝 Commits (10+) - [`e75535d`](https://github.com/netbirdio/netbird/commit/e75535d30b60455e95cb8a249b29160e24d27ec8) Refactor status functions and add first tests - [`78c6231`](https://github.com/netbirdio/netbird/commit/78c6231c0129ec4e461bbd630233718cadac8f54) Added Output struct to properly name json and yaml attr's and add missing tests - [`f36869e`](https://github.com/netbirdio/netbird/commit/f36869e97d0082afaed08b5423fcde65313c979d) use yaml v3 - [`014f1b8`](https://github.com/netbirdio/netbird/commit/014f1b841f6f3702dc58a20edece217b4f386f3a) fix indention in test for yaml output - [`6539b59`](https://github.com/netbirdio/netbird/commit/6539b591b6802b9c863350f884c61c9887380536) fix indention in test for detail output - [`8276e09`](https://github.com/netbirdio/netbird/commit/8276e0908a7d1d8f1e24b74fa6b9796c1b44cebc) clean go.mod - [`0350faf`](https://github.com/netbirdio/netbird/commit/0350faf75d657b08dcce5913c5170ac80ba7e198) return empty strings for not applicable values - [`a0f2b5f`](https://github.com/netbirdio/netbird/commit/a0f2b5f591ee335a519b85995f2bcf694fc166d1) fix codacy - [`5782496`](https://github.com/netbirdio/netbird/commit/5782496287b8e466b220d693e1d72aaa9cc40f9f) fix codacy - [`4330bfd`](https://github.com/netbirdio/netbird/commit/4330bfd8ca8efa4c592e4f321dd18d367a67e0da) Merge branch 'main' into feature/extend-client-status-cmd-to-print-json-or-yaml ### 📊 Changes **3 files changed** (+594 additions, -178 deletions) <details> <summary>View changed files</summary> 📝 `client/cmd/status.go` (+292 -177) ➕ `client/cmd/status_test.go` (+301 -0) 📝 `go.mod` (+1 -1) </details> ### 📄 Description ## Describe your changes Added cmd flags for the status command in the client to report in json or yaml format. Refactored existing code to allow reuse for other formats. Switched to using separate output struct for better sorting and naming of fields in the output string without changing the internally used structs. ### Example outputs: `netbird status --detail` [detail.txt](https://github.com/netbirdio/netbird/files/10840499/detail.txt) `netbird status --json` [json.txt](https://github.com/netbirdio/netbird/files/10840502/json.txt) `netbird status --yaml` [yaml.txt](https://github.com/netbirdio/netbird/files/10840504/yaml.txt) The flags `--detail`, `--json`, `--yaml` and `--ipv4` are set to mutually exclusive. ## Issue ticket number and link ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [x] It is a refactor - [x] Created tests that fail without the change (if possible) - [ ] Extended the README / documentation, if necessary --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 02:06:56 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#12895