MCPcopy
hub / github.com/basecamp/once / View

Method View

internal/ui/remove.go:113–145  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

111}
112
113func (m Remove) View() string {
114 titleLine := Styles.TitleRule(m.width, m.app.Settings.Host, "remove")
115
116 var contentView string
117 if m.removing {
118 contentView = m.progress.View()
119 } else {
120 var errorLine string
121 if m.err != nil {
122 errorLine = lipgloss.NewStyle().Foreground(Colors.Error).Width(m.width).Align(lipgloss.Center).Render(docker.ErrorMessage(m.err))
123 }
124 contentView = lipgloss.JoinVertical(lipgloss.Center, errorLine, "", m.confirmation.View())
125 }
126
127 var helpLine string
128 if !m.removing {
129 helpLine = Styles.CenteredLine(m.width, m.help.View())
130 }
131
132 titleHeight := 2 // title + blank line
133 helpHeight := lipgloss.Height(helpLine)
134 middleHeight := m.height - titleHeight - helpHeight
135
136 centeredContent := lipgloss.Place(
137 m.width,
138 middleHeight,
139 lipgloss.Center,
140 lipgloss.Center,
141 contentView,
142 )
143
144 return titleLine + "\n\n" + centeredContent + helpLine
145}
146
147// Private
148

Callers

nothing calls this directly

Calls 5

ErrorMessageFunction · 0.92
TitleRuleMethod · 0.80
CenteredLineMethod · 0.80
ViewMethod · 0.65
HeightMethod · 0.45

Tested by

no test coverage detected