Skip to content

WIP: Add support for navigating interactive prompts with 'q' key#452

Merged
qcserestipy merged 1 commit into
goharbor:mainfrom
qcserestipy:435_artifact_list
May 26, 2025
Merged

WIP: Add support for navigating interactive prompts with 'q' key#452
qcserestipy merged 1 commit into
goharbor:mainfrom
qcserestipy:435_artifact_list

Conversation

@qcserestipy

@qcserestipy qcserestipy commented May 6, 2025

Copy link
Copy Markdown
Collaborator

Fixes #435

Problem

Currently, the Harbor CLI's interactive selection prompts don't properly support navigation between different selection levels. When a user presses 'q':

  • The UI exits, but the command doesn't properly handle this special value
  • Users can't easily go back to previous selection screens
  • The selection process can get stuck in loops or require restarting the command

Solution

This PR implements proper handling of the 'q' key in interactive prompts to enable intuitive navigation:

  • At the top-level prompt (project selection), 'q' exits the command
  • At lower-level prompts (repository, artifact selection), 'q' goes back to the previous selection level
  • Clear feedback messages inform users about navigation options

@Vad1mo Vad1mo requested a review from Copilot May 14, 2025 12:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 enhances the interactive prompt navigation in Harbor CLI by implementing proper handling of the 'q' key. Key changes include:

  • Adding a handler for the 'q' key in the selection prompt model to support exit behavior.
  • Incorporating loop logic in artifact listing to allow users to return to the project selection prompt from repository selection.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/views/base/selection/model.go Added case for "q" to trigger a quit in selection mode.
cmd/harbor/root/artifact/list.go Introduced loop logic to allow going back to project selection upon pressing "q" during repository selection.

Comment thread pkg/views/base/selection/model.go Outdated
Comment thread cmd/harbor/root/artifact/list.go Outdated
@Vad1mo Vad1mo changed the title WIP: Add support for navigating interactive prompts with 'q' key Add support for navigating interactive prompts with 'q' key May 20, 2025
@Vad1mo Vad1mo added the Changes Requesed feedback that must be addressed before merging. label May 20, 2025
@qcserestipy qcserestipy changed the title Add support for navigating interactive prompts with 'q' key WIP: Add support for navigating interactive prompts with 'q' key May 20, 2025
Signed-off-by: Patrick Eschenbach <patrickeschenbach96@gmail.com>
@qcserestipy

Copy link
Copy Markdown
Collaborator Author

The fix was easier in the end. To keep it consistent with the rest of the code a simple return missing in case repoName is empty as selection.

@codecov

codecov Bot commented May 26, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@89d1f40). Learn more about missing BASE report.

Files with missing lines Patch % Lines
cmd/harbor/root/artifact/tags.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #452   +/-   ##
=======================================
  Coverage        ?   11.64%           
=======================================
  Files           ?      163           
  Lines           ?     8170           
  Branches        ?        0           
=======================================
  Hits            ?      951           
  Misses          ?     7112           
  Partials        ?      107           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@qcserestipy

Copy link
Copy Markdown
Collaborator Author

Since it was a minor change I am going to merge this immediately.

@qcserestipy qcserestipy merged commit a1df056 into goharbor:main May 26, 2025
9 checks passed
Darkhood148 pushed a commit to Darkhood148/harbor-cli that referenced this pull request May 27, 2025
Signed-off-by: Patrick Eschenbach <patrickeschenbach96@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changes Requesed feedback that must be addressed before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

artifact tags list cmd should exit on q

3 participants