diff options
| -rw-r--r-- | indexers/pikdex/index.go | 2 | ||||
| -rw-r--r-- | indexers/pikdex/meta.go | 7 | ||||
| -rw-r--r-- | menu/icon.go | 3 | ||||
| -rw-r--r-- | menu/source.go | 5 | ||||
| -rw-r--r-- | motd/motd.go | 2 |
5 files changed, 13 insertions, 6 deletions
diff --git a/indexers/pikdex/index.go b/indexers/pikdex/index.go index 2bb5d36..64e76e6 100644 --- a/indexers/pikdex/index.go +++ b/indexers/pikdex/index.go @@ -77,10 +77,12 @@ func (u *pikdex) Index(absPath string, f fs.FS, runners []model.Runner) ([]model mod := u.mods[absPath] u.Unlock() if mod == nil { + u.Lock() u.mods[absPath] = &SourceData{ Path: absPath, } mod = u.mods[absPath] + u.Unlock() } err = fs.WalkDir(f, root, func(p string, d fs.DirEntry, err error) error { diff --git a/indexers/pikdex/meta.go b/indexers/pikdex/meta.go index af1af93..750ce47 100644 --- a/indexers/pikdex/meta.go +++ b/indexers/pikdex/meta.go @@ -1,6 +1,7 @@ package pikdex import ( + "github.com/charmbracelet/lipgloss" "strings" ) @@ -18,7 +19,11 @@ var MetaFiles = map[string]MetaSetter{ } }, ".icon": func(s *SourceData, content string) { - s.Icon = string([]rune(strip(content))[0:2]) + icon := strip(content) + desiredWidth := lipgloss.Width(icon) + diff := desiredWidth - len([]rune(icon)) + icon += strings.Repeat(" ", diff) + s.Icon = icon }, } diff --git a/menu/icon.go b/menu/icon.go index 2043731..102706e 100644 --- a/menu/icon.go +++ b/menu/icon.go @@ -14,9 +14,6 @@ var ( ) func Icon(input string) string { - if strings.TrimSpace(input) == "" { - return "" - } return IconStyle.Render(input) } diff --git a/menu/source.go b/menu/source.go index 9e0f56a..2d02a5d 100644 --- a/menu/source.go +++ b/menu/source.go @@ -32,6 +32,9 @@ var ( st := lipgloss.NewStyle().Faint(true) return st }) + SourceIconStyle = style.New(func() lipgloss.Style { + return lipgloss.NewStyle().Width(3) + }) ) func (m *Model) Source(src *model.HydratedSource) string { @@ -52,7 +55,7 @@ func (m *Model) Source(src *model.HydratedSource) string { targetContent := lipgloss.JoinVertical(lipgloss.Top, targets...) - icon := PaddedIcon(src.Icon) + icon := SourceIconStyle.Render(PaddedIcon(src.Icon)) parts := []string{ SourceHeaderStyle.Render(lipgloss.JoinHorizontal(lipgloss.Left, SourceLabelStyle.Render(lipgloss.JoinHorizontal(lipgloss.Left, icon, src.Label()), SourcePathStyle.Render(src.ShortPath())))), diff --git a/motd/motd.go b/motd/motd.go index a732695..2a53899 100644 --- a/motd/motd.go +++ b/motd/motd.go @@ -6,7 +6,7 @@ var Messages = []string{ "use the -a flag to invoke from anywhere", "combine -a with -y to invoke from anywhere without confirming", "`--env dev` will include .env, .env.dev, .env-dev, and dev.env", - "pik will start in a viewport if the terminal is too thin", + "pik will start in a viewport if the terminal is too short", "instead of .pik you can use .tasks, or .bin, or any of these with _", "include .pre. in a pik target filename to make it run as a prerequisite for other targets", "a pik target filename with .post. will make it run after another targets completes successfully", |
