selection: set Aborted when user cancels TUI picker - #1051
Open
CygnusMaximillian wants to merge 1 commit into
Open
selection: set Aborted when user cancels TUI picker#1051CygnusMaximillian wants to merge 1 commit into
CygnusMaximillian wants to merge 1 commit into
Conversation
Signed-off-by: CygnusMaximillian <dprajjwal11@gmail.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1051 +/- ##
=========================================
- Coverage 10.99% 9.54% -1.45%
=========================================
Files 173 321 +148
Lines 8671 16097 +7426
=========================================
+ Hits 953 1536 +583
- Misses 7612 14427 +6815
- Partials 106 134 +28 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
NucleoFusion
approved these changes
Jul 19, 2026
NucleoFusion
left a comment
Contributor
There was a problem hiding this comment.
lgtm!
thanks for the contribution
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.
Fixes #947
Summary
Interactive selection views did not record user cancellation correctly. The shared Bubbletea selection model already had an
Abortedfield, butUpdate()never set it when users pressedq,esc, orctrl+c.This PR handles those keys in the base selection model and sets
Aborted = truebefore quitting, so callers can distinguish cancellation from an empty selection.Scope: This PR only changes
pkg/views/base/selection/model.go. Updating all selection wrappers to consumeAbortedis intentionally left for a follow-up PR, per maintainer feedback on #947.Problem
When a command is run without a positional argument, Harbor CLI opens an interactive picker. If the user cancels with
q,esc, orctrl+c, the picker closes but the base model returned with:Aborted = falseChoice = ""Callers that check
Aborted(e.g. project selection) fell through to a misleading"no project selected"error. Callers that do not checkAborted(e.g. registry selection) could continue with empty values or zero IDs.Demo
Screencast.From.2026-07-14.15-28-11.mp4
What the screencast shows:
harbor project view→ picker opens → pressq→ error:no project selecteduser aborted project selection/to filter →escexits filter mode without aborting the pickerChanges
In
pkg/views/base/selection/model.go:ctrl+c→ setAborted = true, quitq/esc→ setAborted = true, quitFilterState() == list.Filteringsoqcan be typed in the search box andescexits filter modeCode path