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

+8 -2
View File
@@ -99,13 +99,13 @@ func (d *dialog) view(width, height int) string {
return framed(d.title, content, w, len(lines)+2, color)
}
func helpDialog(version string) *dialog {
func helpDialog(version, update string) *dialog {
k := func(key, desc string) string { return stKey.Render(fit(key, 16)) + desc }
title := "Help"
if version != "" {
title = "Help · ghosttyconf " + version
}
return &dialog{
d := &dialog{
title: title,
lines: []string{
stBold.Render("Browsing"),
@@ -155,4 +155,10 @@ func helpDialog(version string) *dialog {
},
keys: []dialogKey{{"esc", "Close"}},
}
if update != "" {
note := stChanged.Render("ghosttyconf "+update+" is available") +
stDim.Render(", run ") + "ghosttyconf --update" + stDim.Render(" after quitting")
d.lines = append([]string{note, ""}, d.lines...)
}
return d
}