docs: extract goget manpage to standalone troff source

This commit is contained in:
2026-06-29 21:16:28 +02:00
parent 9ef62520c7
commit 9867e2817e
8 changed files with 1163 additions and 206 deletions
+23
View File
@@ -11,6 +11,10 @@ run:
# Build the binary
build:
# Keep the embedded manpage in sync with man/goget.1. //go:embed
# cannot reference files outside the embedding package, so we copy
# the source-of-truth manpage into the package tree before compiling.
cp man/goget.1 cmd/goget/man-page-data/goget.1
go vet ./...
gofmt -l $(find cmd internal pkg -name '*.go') | grep . && exit 1 || true
go build -ldflags "-s -w" -o bin/goget ./cmd/goget
@@ -22,3 +26,22 @@ test:
# Remove build artifacts
uninstall:
rm -rf bin/ coverage.out
# Validate the manpage with groff (zero warnings on success). Requires
# `groff` to be installed — skipped silently otherwise.
man:
@command -v groff >/dev/null || { echo "groff not installed, skipping"; exit 0; }
groff -man -ww -Kutf-8 -z man/goget.1
# Install the manpage to ~/.local/share/man/man1/ (XDG rootless).
# After install, `man goget` resolves it automatically. Re-run safely to
# pick up edits.
install-man: man
@mkdir -p "$HOME/.local/share/man/man1"
gzip -c -f man/goget.1 > "$HOME/.local/share/man/man1/goget.1.gz"
@echo "Installed: $HOME/.local/share/man/man1/goget.1.gz"
# Remove the manpage installed by `just install-man`.
uninstall-man:
rm -f "$HOME/.local/share/man/man1/goget.1.gz"
@echo "Removed: $HOME/.local/share/man/man1/goget.1.gz"