MCPcopy
hub / github.com/derailed/k9s / addSection

Method addSection

internal/view/help.go:322–350  ·  view source on GitHub ↗
(c int, title string, hh model.MenuHints)

Source from the content-addressed store, hash-verified

320}
321
322func (h *Help) addSection(c int, title string, hh model.MenuHints) {
323 if len(hh) > h.maxRows {
324 h.maxRows = len(hh)
325 }
326 row := 0
327 h.SetCell(row, c, h.titleCell(title))
328 h.addSpacer(c + 1)
329 row++
330
331 for _, hint := range hh {
332 col := c
333 h.SetCell(row, col, padCellWithRef(ui.ToMnemonic(hint.Mnemonic), h.maxKey, hint.Mnemonic))
334 col++
335 h.SetCell(row, col, padCell(hint.Description, h.maxDesc))
336 row++
337 }
338
339 if len(hh) >= h.maxRows {
340 return
341 }
342
343 for i := h.maxRows - len(hh); i > 0; i-- {
344 col := c
345 h.SetCell(row, col, padCell("", h.maxKey))
346 col++
347 h.SetCell(row, col, padCell("", h.maxDesc))
348 row++
349 }
350}
351
352func (h *Help) updateStyle() {
353 var (

Callers 1

buildMethod · 0.95

Calls 5

titleCellMethod · 0.95
addSpacerMethod · 0.95
ToMnemonicFunction · 0.92
padCellWithRefFunction · 0.85
padCellFunction · 0.85

Tested by

no test coverage detected