Skip to content

fix: removing dependency on ansi and using lipgloss#739

Merged
bupd merged 1 commit intogoharbor:mainfrom
NucleoFusion:refactor/hardcoded-ansi
Mar 13, 2026
Merged

fix: removing dependency on ansi and using lipgloss#739
bupd merged 1 commit intogoharbor:mainfrom
NucleoFusion:refactor/hardcoded-ansi

Conversation

@NucleoFusion
Copy link
Contributor

Description

  • Fixes # NA

Type of Change

Please select the relevant type.

  • Bug fix
  • New feature
  • Refactor
  • Documentation update
  • Chore / maintenance

Changes

  • Removes dependency on the ANSI styling in /pkg/views/styles.go
  • Uses lipgloss instead of hardcoded ANSI

Signed-off-by: NucleoFusion <lakshit.singh.mail@gmail.com>
@codecov
Copy link

codecov bot commented Mar 12, 2026

Codecov Report

❌ Patch coverage is 0% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 7.46%. Comparing base (60ad0bd) to head (3549cea).
⚠️ Report is 112 commits behind head on main.

Files with missing lines Patch % Lines
pkg/views/robot/view/view.go 0.00% 7 Missing ⚠️
pkg/views/health/view.go 0.00% 2 Missing ⚠️
pkg/views/robot/list/view.go 0.00% 2 Missing ⚠️
pkg/views/styles.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             main    #739      +/-   ##
=========================================
- Coverage   10.99%   7.46%   -3.53%     
=========================================
  Files         173     261      +88     
  Lines        8671   13021    +4350     
=========================================
+ Hits          953     972      +19     
- Misses       7612   11940    +4328     
- Partials      106     109       +3     

☔ 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.

@Sypher845 Sypher845 mentioned this pull request Mar 12, 2026
5 tasks
@bupd bupd requested a review from Copilot March 13, 2026 23:33
Copy link
Collaborator

@bupd bupd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@bupd bupd merged commit eb788c0 into goharbor:main Mar 13, 2026
8 of 10 checks passed
Copy link
Contributor

Copilot AI left a 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 replaces hardcoded ANSI escape sequences used for CLI text styling with lipgloss styles, centralizing styling behavior in pkg/views/styles.go and updating affected views to use the new styles.

Changes:

  • Added reusable lipgloss styles for green/red/bold text in pkg/views/styles.go.
  • Replaced direct ANSI concatenation with Style.Render(...) in robot and health views.
  • Removed the old ANSI constant definitions from the shared styles package.

Reviewed changes

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

File Description
pkg/views/styles.go Introduces shared lipgloss styles and removes hardcoded ANSI constants.
pkg/views/robot/view/view.go Updates robot detail output to use lipgloss styles instead of ANSI constants.
pkg/views/robot/list/view.go Updates robot list status styling to use lipgloss styles.
pkg/views/health/view.go Updates health status coloring to use lipgloss styles.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +125 to 131
fmt.Printf("\n%s\n\n", views.BoldStyle.Render("System-level robot with access across projects"))
} else {
permissionsColumns = projectPermissionsColumns
resourceStrings = projectResourceStrings
systemLevel = false
fmt.Printf("%sProject-level robot for project: %s%s\n\n", views.BoldANSI, robot.Permissions[0].Namespace, views.ResetANSI)
fmt.Printf("\n%s\n\n", views.BoldStyle.Render(fmt.Sprintf("System-level robot with access across projects: %s", robot.Permissions[0].Namespace)))
}
}

fmt.Printf("\n%sProject-specific Permissions:%s\n", views.BoldANSI, views.ResetANSI)
fmt.Printf("\n%s\n\n", views.BoldStyle.Render("Project-specific Permissions:"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants