goharbor / goharbor/harbor-cli
[feature]: Add `harbor project member view` command
- Dominant language
- Go
- Stars
- 163
- Forks
- 211
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
## Problem
### What problem does this feature solve?
The `harbor project member` subcommand group is missing a `view` command. Every other resource in harbor-cli (e.g., `registry`, `robot`, `scanner`, `repository`) follows a consistent CRUD-like pattern that includes a `view` subcommand, but `project member` does not.
Currently, users who want to inspect a specific member must run:
`harbor project member list `
and manually search through the results. This is inefficient and breaks scripting workflows where retrieving a single resource deterministically is required.
## Proposed Solution
### Describe the feature or behavior you would like to see.
Add a command:
```
harbor project member view
```
following the same pattern as harbor registry view.
### Behavior
- If both arguments are provided → fetch and display directly
- If arguments are omitted → fall back to interactive prompts
- Support:
- `--wide` for extended columns
- `--output-format json|yaml` for scripting
### Example Usage
**Default output:**
```
$ harbor project member view my-project 5
ID Member Name Type Role Name
5 alice User Developer
```
**With `--wide`:**
```
$ harbor project member view my-project 5 --wide
ID Member Name Type Role Name Role ID Project ID
5 alice User Developer 2 3
```
**With `--output-format json`:**
`{"id": 5, "entity_name": "alice", "entity_type": "u", "role_id": 2, "role_name": "developer"}`
### Implementation note:
The backend is already fully implemented in the codebase. Only the CLI command wiring is missing:
## Alternatives Considered
Have you considered any alternative approaches or workarounds?
The only current workaround is using `harbor project member list ` and filtering output with `--output-format json | jq`. This is verbose, depends on external tooling (jq), and is inefficient
## Additional Context
- Pattern to follow: cmd/harbor/root/registry/view.go
- The existing ViewMember() function in `pkg/views/member/view/view.go` already supports both default and wide column layouts it just needs a command entry point.
Contributor guide
Assessment
This issue has not been assessed yet.