-
Notifications
You must be signed in to change notification settings - Fork 90
Add scope options in labels #475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
5277c5f
to
bc779e8
Compare
Signed-off-by: afeefuddin <[email protected]>
7714c28
to
1a765c8
Compare
Signed-off-by: afeefuddin <[email protected]>
Signed-off-by: afeefuddin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves label commands by refining how scope options and project IDs are handled across listing, creating, updating, and deleting labels. Key changes include updating function signatures to return errors instead of using channels, propagating the project ID through the API calls, and aligning CLI documentation and flag names with the new behavior.
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
pkg/views/project/select/view.go | Adds a new function to select a project with its ID. |
pkg/views/label/select/view.go | Refactors label selection to return the chosen label ID with error handling. |
pkg/views/label/create/view.go | Adds a scope select input and validation for creating a label. |
pkg/prompt/prompt.go | Introduces functions to prompt for project and label IDs with improved error handling. |
pkg/api/label_handler.go | Passes the project ID for label creation and updates the signature for label lookups. |
doc/man-docs/man1/harbor-label-*.1 | Updates the CLI man pages to reflect the new flag naming for project ID. |
doc/cli-docs/harbor-label-*.md | Revises the CLI documentation examples to match the updated flag names. |
cmd/harbor/root/labels/update.go | Changes error handling to return errors and propagates the project ID in updates. |
cmd/harbor/root/labels/list.go | Renames the project ID flag for consistency. |
cmd/harbor/root/labels/delete.go | Adopts RunE for better error propagation and adjusts flag usage. |
cmd/harbor/root/labels/create.go | Passes flags into the label creation view and prompts for project ID as needed. |
Comments suppressed due to low confidence (3)
cmd/harbor/root/labels/update.go:14
- Consider renaming 'UpdateLableCommand' to 'UpdateLabelCommand' to fix the typo and improve clarity.
package labels
pkg/api/label_handler.go:125
- If no label is found in GetLabelIdByName, returning 0 with err (which may be nil) could be misleading. Consider returning a clear error, such as 'label not found', to indicate the absence of a matching label.
return 0, err
cmd/harbor/root/labels/delete.go:45
- [nitpick] Update the error message to clearly indicate that the failure occurred during retrieval of the label id for deletion, for example: 'failed to retrieve label id for deletion: %v'.
return fmt.Errorf("failed to get label id: %v", err)
Improve and fix the scope flag for labels.
1.
harbor-cli label list
Screencast.from.2025-05-18.23-57-18.mp4
2.
harbor-cli label create
Screencast.from.2025-05-19.00-00-24.mp4
3.
harbor-cli label delete
Screencast.from.2025-05-19.00-02-36.mp4
4.
harbor-cli label update
Screencast.from.2025-05-19.00-03-58.mp4