view.go 542 B

123456789101112131415161718192021222324252627282930
  1. package footer
  2. import (
  3. "fmt"
  4. "charm.land/lipgloss/v2"
  5. )
  6. var style = lipgloss.NewStyle().Faint(true).PaddingLeft(1).PaddingTop(1)
  7. func Render(sortCol string, filterKind string, humanize bool, showDiag bool, width int) string {
  8. hum := "on"
  9. if !humanize {
  10. hum = "off"
  11. }
  12. diag := "off"
  13. if showDiag {
  14. diag = "on"
  15. }
  16. help := fmt.Sprintf(
  17. "[Tab] section: %s | [s] sort: %s | [h] humanize: %s | [d] diagnostics: %s | [Enter] detail | [q] quit",
  18. filterKind,
  19. sortCol,
  20. hum,
  21. diag,
  22. )
  23. return style.Width(width).Render(help)
  24. }