Skip to content

Commit f301a09

Browse files
committed
Refactor: update browseResultFromUninstall function to include installation scope in TUI messages
1 parent b98a371 commit f301a09

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

cmd/browse_model.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -406,12 +406,11 @@ func browseResultFromInstall(fontName, source string, msg installFinishedMsg) (t
406406
}
407407
}
408408

409-
func browseResultFromUninstall(fontName, source string, msg uninstallFinishedMsg) (title string, errorTitle bool, body string) {
409+
func browseResultFromUninstall(fontName string, installScope platform.InstallationScope, msg uninstallFinishedMsg) (title string, errorTitle bool, body string) {
410410
fontName = strings.TrimSpace(fontName)
411411
if fontName == "" {
412412
fontName = shared.PlaceholderNA
413413
}
414-
source = browseNormalizeSourceLabel(source)
415414
if msg.err != nil {
416415
return "Error", true, ui.RenderError(msg.err.Error())
417416
}
@@ -420,7 +419,12 @@ func browseResultFromUninstall(fontName, source string, msg uninstallFinishedMsg
420419
}
421420
switch msg.result.Status {
422421
case StatusCompleted:
423-
line := fmt.Sprintf("'%s' successfully removed from %s.", fontName, source)
422+
var line string
423+
if installScope == platform.MachineScope {
424+
line = fmt.Sprintf("'%s' has been uninstalled successfully from this machine.", fontName)
425+
} else {
426+
line = fmt.Sprintf("'%s' has been uninstalled successfully.", fontName)
427+
}
424428
return "Uninstalled", false, ui.Text.Render(line)
425429
case StatusSkipped:
426430
return "Skipped", false, ui.InfoText.Render(msg.result.Message)
@@ -863,12 +867,11 @@ func (m *browseModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
863867

864868
case uninstallFinishedMsg:
865869
fontName := m.removingFontName
866-
source := m.removingSourceLabel
867870
m.removing = false
868871
m.removingFontName = ""
869872
m.removingSourceLabel = ""
870873
m.statusProgress = 0
871-
title, errTitle, body := browseResultFromUninstall(fontName, source, msg)
874+
title, errTitle, body := browseResultFromUninstall(fontName, m.installScope, msg)
872875
m.openResultModal(title, errTitle, body)
873876
cmd := m.syncTableDimensions()
874877
return m, cmd

0 commit comments

Comments
 (0)