From 64f1ef86addc3dcaa460161a46edc181a97850d2 Mon Sep 17 00:00:00 2001 From: bishal7679 Date: Sat, 25 May 2024 12:23:27 +0530 Subject: [PATCH] updated readme with code snippet Signed-off-by: bishal7679 --- README.md | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 85 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5ab01d4e..ac2381e7 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ The Harbor CLI is designed to enhance your interaction with the Harbor container registry. Built on Golang, it offers a user-friendly interface to perform various tasks related to projects, registries, and more. Whether you're creating, updating, or managing resources, the Harbor CLI streamlines your workflow efficiently. -# **Project Features** 🀯 +# Project Features 🀯 πŸ”Ή Get details about projects, registries, repositories and more
πŸ”Ή Create new projects, registries, and other resources
@@ -15,11 +15,80 @@ The Harbor CLI is designed to enhance your interaction with the Harbor container πŸ”Ή Run commands with various flags for enhanced functionality
πŸ”Ή More features coming soon... 🚧 -# Demo Screenshot +# Example CommandsπŸ’‘ -![demo-1](https://github.com/goharbor/harbor-cli/assets/70086051/63b5f6b7-319b-4c05-968a-59489f7fdd35) +```bash +➜ harbor --help +Official Harbor CLI + +Usage: + harbor [command] + +Examples: + +// Base command: +harbor + +// Display help about the command: +harbor help + + +Available Commands: + completion Generate the autocompletion script for the specified shell + help Help about any command + login Log in to Harbor registry + project Manage projects and assign resources to them + registry Manage registries + repo Manage repositories + user Manage users + version Version of Harbor CLI + +Flags: + --config string config file (default is $HOME/.harbor/config.yaml) (default "/home/bishal/.harbor/config.yaml") + -h, --help help for harbor + -o, --output-format string Output format. One of: json|yaml + -v, --verbose verbose output + +Use "harbor [command] --help" for more information about a command. +``` + +#### Log in to Harbor Registry + +```bash +harbor login demo.goharbor.io -u admin -p Harbor12345 +``` + +#### Create a New Project + +```bash +harbor project create +``` -![demo-2](https://github.com/goharbor/harbor-cli/assets/70086051/00afaa16-41c4-460d-8ec1-7b06b02bd80c) +#### List all Projects + +```bash +harbor project list + +# output +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ Project Name Access Level Type Repo Count Creation Time β”‚ +β”‚ ──────────────────────────────────────────────────────────────────────────────────────── β”‚ +β”‚ library public project 0 1 hour ago β”‚ +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +``` + +#### List all Repository in a Project + +```bash +harbor repo list + +# output +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ Name Artifacts Pulls Last Modified Time β”‚ +β”‚ ────────────────────────────────────────────────────────────────────────────────────── β”‚ +β”‚ library/harbor-cli 1 0 0 minute ago β”‚ +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +``` # Supported Platforms @@ -32,14 +101,18 @@ Windows | βœ… # Installation ## Build From Source + ```bash git clone https://github.com/goharbor/harbor-cli.git cd harbor-cli/cmd/harbor go build . sudo mv harbor /usr/local/bin/ ``` + ## Linux and MacOS + use `amd64/arm64` as per your system architecture + ```bash ## Linux tar -xzf harbor_0.0.1_linux_amd64.tar.gz @@ -51,10 +124,12 @@ tar -xzf harbor_0.0.1_darwin_amd64.tar.gz cd harbor_0.0.1_darwin_amd64 sudo mv harbor /usr/local/bin/ ``` + ## Windows - - Download `harbor_0.0.1_windows_amd64.zip` and Extract it. - - To easily use the harbor-cli from the command line, add the directory containing the `harbor.exe` to your system PATH. - - In the Edit Environment Variable window, click on "New" and add the path to the directory where `harbor.exe` is located (e.g., `C:\path\to\harbor_0.0.1_windows_amd64`). + +```bash +winget install harbor +``` # Community @@ -64,11 +139,14 @@ sudo mv harbor /usr/local/bin/ * **Slack:** Join Harbor's community for discussion and ask questions: [Cloud Native Computing Foundation](https://slack.cncf.io/), channel: [#harbor](https://cloud-native.slack.com/messages/harbor/), [#harbor-dev](https://cloud-native.slack.com/messages/harbor-dev/) and [#harbor-cli](https://cloud-native.slack.com/messages/harbor-cli/). # License + This project is licensed under the Apache 2.0 License. See the [LICENSE](https://github.com/goharbor/harbor-cli/blob/main/LICENSE) file for details. # Acknowledgements + This project is maintained by the Harbor community. We thank all our contributors and users for their support. # ❀️ Show your support + For any questions or issues, please open an issue on our [GitHub Issues](https://github.com/goharbor/harbor-cli/issues) page.
Give a ⭐ if this project helped you, Thank YOU!