goharbor / goharbor/harbor-cli
[bug]: project member update ignores positional member name argument
- Dominant language
- Go
- Stars
- 163
- Forks
- 211
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
## Description
The `project member update` command advertises the following usage:
```bash
harbor project member update [ProjectName] [memberName]
```
However, when a member name is provided as the second positional argument, it is ignored and the CLI falls back to the interactive member selection prompt.
## Steps to Reproduce
1. Run command:
```bash
harbor project member update my-project bob --roleid 2
```
2. Ensure `bob` is an existing member of `my-project`.
3. Observe that the CLI prompts you to select a member interactively instead of using the supplied member name.
## Expected Behavior
The CLI should use the supplied positional member name (`bob`), resolve it to the corresponding user ID, and update the member without prompting.
## Actual Behavior
The positional member name is ignored and an interactive prompt is displayed.
## Environment
- OS: Windows 10
- Tool version: Harbor CLI (current `main` branch)
- Other relevant details: Built from source using Go.
## Additional Context
The command attempts to parse the second positional argument as an integer ID using `strconv.ParseInt`, ignores the parsing error, and never stores the supplied member name. As a result, the command always falls back to interactive member selection instead of resolving the provided member name.
Contributor guide
Research direction
Start at the implementation of the `project member update` command and trace how it handles the second positional argument and `strconv.ParseInt`. Reproduce with `harbor project member update my-project bob --roleid 2`; done means the supplied member name resolves to the existing member and the command updates it without opening the interactive selection prompt.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 70/100