goharbor / harbor-cli

[Sandbox] Official Harbor CLI
Apache License 2.0
31 stars 37 forks source link

Add: Statistics Command #93

Open bupd opened 2 months ago

bupd commented 2 months ago

Overview:

This PR adds stats command which shows the overall statistic information about the projects and repositories.

Screenshots:

stats

Vad1mo commented 2 months ago

I would put this information into info becuase, this here so little for having its own command

Vad1mo commented 2 months ago

While you are at info you can also add this fields in here

See: https://demo.goharbor.io/api/v2.0/systeminfo

Example

{
  "auth_mode": "db_auth",
  "banner_message": "",
  "harbor_version": "v2.10.0-6abb4eab",
  "oidc_provider_name": "",
  "primary_auth_mode": false,
  "self_registration": true
}

keep also in mind the the info is more extensive for authenticated users

auth_mode   "db_auth"
banner_message  ""
current_time    "2024-05-30T22:11:59.507Z"
external_url    "https://demo.goharbor.io"
harbor_version  "v2.10.0-6abb4eab"
has_ca_root false
notification_enable true
oidc_provider_name  ""
primary_auth_mode   false
project_creation_restriction    "everyone"
read_only   false
registry_storage_provider_name  "filesystem"
registry_url    "demo.goharbor.io"
self_registration   true
bupd commented 2 months ago

Will update it accordingly.

bupd commented 2 months ago

Screenshots:

info

by merging quota Command in PR: #97
we can reuse function to convert bytes to human readable storage format.