Skip to content

Commit

Permalink
Add proposal for official CLI project for Harbor
Browse files Browse the repository at this point in the history
Signed-off-by: Akshat <akshat25iiit@gmail.com>
  • Loading branch information
akshatdalton committed Mar 26, 2023
1 parent ebc90f3 commit 97e5b8a
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions proposals/new/cli.md
@@ -0,0 +1,79 @@
# Proposal: Add Official CLI for Harbor

Author: Akshat/[akshatdalton](https://github.com/akshatdalton)

## Abstract

This proposal aims to add the official CLI for Harbor. It will have basic features like user login and other CRUD operations like create project, get project, list projects, etc.

## Background

There are some unofficial CLI projects to interact with Harbor API, and now Harbor wants to provide official support for CLI.

## Goals

- Implement official CLI for Harbor.
- Support basic CRUD operations like create project, get project, list projects, etc.

## Implementation

### Directory structure

```
cli/
├── main.go
├── go.sum
├── go.mod
├── README.md
├── .gitignore
└── cmd/
├── root.go
├── create_project.go
├── delete_project.go
├── login.go
├── logout.go
├── util.go
├── .
├── .
└── .
```

I will be using [cobra](https://github.com/spf13/cobra) to make this CLI tool and it will have the directory structure as shown above. For each of the commands, either we can have a single file or an individual sub-package for them.

E.g.:<br>

- for a single file -

```
cmd/
├── create_project.go
├── create_project_test.go
├── delete_project.go
├── delete_project_test.go
├── .
├── .
├── .
```

- for an individual sub-package -

```
cmd/
├── project
├── project.go
├── create_project.go
├── create_project_test.go
├── delete_project.go
├── delete_project_test.go
├── .
├── .
├── .
```

<br>

User credentials will be stored in `~/.harbor/auth.yaml` upon sign in and the same will be used to read the credentials to make the API calls.

<br>

[harbor/go-client](https://github.com/goharbor/go-client) will be used to make any API calls for any given server address.

0 comments on commit 97e5b8a

Please sign in to comment.