Add self-update, version 1.0.1

ghosttyconf --update installs the newest release from git.micw.org,
--check-update only checks. The download lands next to the running
binary, is started once with --version and only then replaces it.

Once a day a normal start asks in the background and mentions a newer
release in the header, at the top of the help and on stderr after
quitting; only on a terminal and not with GHOSTTYCONF_NO_UPDATE_CHECK
set. selfupdate.go is nscan's copyable template, with goca's --update
spelling in the hints.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mikeandClaude Opus 5.5 committed 2026-10-28 10:22:51 +01:00
1 parent e5750ef24b
commit fb5602452a
13 files changed
+818 -11

No files matched your search

+13 -3
View File
@@ -31,9 +31,19 @@ func (a *App) View() string {
func (a *App) viewHeader() string {
title := stTitle.Render("Ghostty Config Editor") + " "
right := stHeader.Render(fmt.Sprintf(" %s · %d options ", a.sch.Source, len(a.sch.Options)))
if lipgloss.Width(title)+lipgloss.Width(right)+20 > a.width {
right = ""
info := stHeader.Render(fmt.Sprintf(" %s · %d options ", a.sch.Source, len(a.sch.Options)))
fits := func(s string) bool { return lipgloss.Width(title)+lipgloss.Width(s)+20 <= a.width }
// A newer release outlasts the option count when space runs short; the
// help says how to get it.
upd := " ghosttyconf " + a.update + " available"
var right string
switch {
case a.update != "" && fits(stChanged.Render(upd)+stHeader.Render(" ·")+info):
right = stChanged.Render(upd) + stHeader.Render(" ·") + info
case a.update != "" && fits(stChanged.Render(upd+" ")):
right = stChanged.Render(upd + " ")
case fits(info):
right = info
}
path := shortPath(a.file.Path)
if !a.file.Exists {