goharbor / harbor-cli

[Sandbox] Official Harbor CLI
Apache License 2.0
42 stars 45 forks source link

Harbor CLI does not support yaml output #240

Closed bupd closed 3 hours ago

bupd commented 3 weeks ago

This issue presists for all commands. yaml should be supported.

❯ ./harbor-dev registry list -h
list registry

Usage:
  harbor registry list [flags]

Flags:
  -h, --help            help for list
      --page int        Page number (default 1)
      --page-size int   Size of per page (default 10)
  -q, --query string    Query string to query resources
      --sort string     Sort the resource list in ascending or descending order

Global Flags:
      --config string          config file (default is $HOME/.harbor/config.yaml) (default "/home/bupd/.harbor/config.yaml")
  -o, --output-format string   Output format. One of: json|yaml
  -v, --verbose                verbose output

This should be yaml but we get json

❯ ./harbor-dev registry list -o yaml
{
  "Link": "",
  "XTotalCount": 8,
  "Payload": [
    {
      "creation_time": "2024-10-07T13:27:37.749Z",
      "credential": {},
      "id": 2,
      "name": "8gears.container-registry.com",
      "status": "healthy",
      "type": "harbor",
      "update_time": "2024-10-07T13:27:45.201Z",
      "url": "https://8gears.container-registry.com"

We can take some functionalities from this PR #74.