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

+26 -1
View File
@@ -57,7 +57,7 @@ but Ghostty.
```sh
# macOS on Apple silicon; for other systems, replace darwin-arm64 with
# darwin-amd64, linux-amd64 or linux-arm64
curl -fLo ghosttyconf https://git.micw.org/mike/ghosttyconf/releases/download/1.0.0/ghosttyconf-darwin-arm64
curl -fLo ghosttyconf https://git.micw.org/mike/ghosttyconf/releases/download/1.0.1/ghosttyconf-darwin-arm64
chmod +x ghosttyconf
mv ghosttyconf ~/bin/ # or any other directory in your $PATH
```
@@ -77,6 +77,29 @@ make install # installs ghosttyconf into $(go env GOPATH)/bin
`make build` builds `./ghosttyconf` in the source directory instead.
### Updating
```sh
ghosttyconf --update # install the newest release in place of this binary
ghosttyconf --check-update # only check
```
The new binary is downloaded next to the old one and started once with
`--version` before it replaces the old one, so a broken download never takes
its place. If ghosttyconf lives in a directory you cannot write to, such as
`/usr/local/bin`, run `sudo ghosttyconf --update`.
Once a day, ghosttyconf also asks git.micw.org in the background whether there
is a newer release. If there is, the next start says so in the header of the
editor, and again in the terminal after you quit. Nothing is installed without
`--update`. The check stays quiet when stderr is not a terminal, and
`GHOSTTYCONF_NO_UPDATE_CHECK=1` turns it off. Its result is kept in
`~/Library/Caches/ghosttyconf/update.json` on macOS and
`~/.cache/ghosttyconf/update.json` on Linux; losing it only means asking once
more.
Self-update arrived in 1.0.1. Replace 1.0.0 by hand once.
## 💡 Quick start
```sh
@@ -199,6 +222,8 @@ ghosttyconf [flags] [config-file]
--no-reload do not reload Ghostty after saving
--offline do not run ghostty; use the built-in option list
--print-path print the config file that would be edited and exit
--update install the newest release in place of this binary
--check-update only check whether there is a newer release
--version print the version and exit
```