Closed
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]>
Contributor
There was a problem hiding this comment.
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)
bupd
approved these changes
Jun 17, 2025
Contributor
|
@bupd This can be closed since the PR is merged |
Collaborator
|
closing this in favor of #560 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improve and fix the scope flag for labels.
1.
harbor-cli label listScreencast.from.2025-05-18.23-57-18.mp4
2.
harbor-cli label createScreencast.from.2025-05-19.00-00-24.mp4
3.
harbor-cli label deleteScreencast.from.2025-05-19.00-02-36.mp4
4.
harbor-cli label updateScreencast.from.2025-05-19.00-03-58.mp4