Skip to content

Commit e9e462b

Browse files
committed
properly handle json output for uninstall
1 parent 4db1a46 commit e9e462b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

cmd/dbc/uninstall.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,20 @@ func (m uninstallModel) Init() tea.Cmd {
6262
return m.startUninstall
6363
}
6464

65+
func (m uninstallModel) FinalOutput() string {
66+
if m.jsonOutput {
67+
return fmt.Sprintf("{\"status\": \"success\", \"driver\": \"%s\"}\n", m.Driver)
68+
}
69+
return fmt.Sprintf("Driver `%s` uninstalled successfully!\n", m.Driver)
70+
}
71+
6572
func (m uninstallModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
6673
cmds := make([]tea.Cmd, 0)
6774
switch msg := msg.(type) {
6875
case config.DriverInfo:
6976
return m.performUninstall(msg)
7077
case driverDidUninstallMsg:
71-
if m.jsonOutput {
72-
return m, tea.Sequence(tea.Printf("{\"status\": \"success\", \"driver\": \"%s\"}\n", m.Driver), tea.Quit)
73-
}
74-
return m, tea.Sequence(tea.Printf("Driver `%s` uninstalled successfully!\n", m.Driver), tea.Quit)
78+
return m, tea.Quit
7579
case error:
7680
m.status = 1
7781
if m.jsonOutput {

0 commit comments

Comments
 (0)