feat: better formatting for titles

This commit is contained in:
Muhammad Nauman Raza 2024-03-30 12:54:11 +00:00
parent 1193989c56
commit 1aefecc727
Signed by: devraza
GPG key ID: 91EAD6081011574B

View file

@ -3,6 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"os" "os"
"strings"
"github.com/charmbracelet/bubbles/help" "github.com/charmbracelet/bubbles/help"
"github.com/charmbracelet/bubbles/key" "github.com/charmbracelet/bubbles/key"
@ -15,6 +16,7 @@ import (
var ( var (
checkMark = lipgloss.NewStyle().Foreground(lipgloss.Color("42")).SetString("✓") checkMark = lipgloss.NewStyle().Foreground(lipgloss.Color("42")).SetString("✓")
docStyle = lipgloss.NewStyle().Margin(1, 2) docStyle = lipgloss.NewStyle().Margin(1, 2)
titleStyle = lipgloss.NewStyle().Bold(true)
) )
type keyMap struct { type keyMap struct {
@ -67,7 +69,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
} }
func (m model) View() string { func (m model) View() string {
s := "Pinging hosts...\n\n" s := titleStyle.Render("Pinging hosts...") + strings.Repeat("\n", 2)
for _, address := range m.addresses { for _, address := range m.addresses {
_, err := probing.NewPinger(fmt.Sprintf("%s", address)) _, err := probing.NewPinger(fmt.Sprintf("%s", address))
if err != nil { if err != nil {