v0.3.0 ea9abc7

Makefile RawHistoryFolder

1.PHONY: bin build test vet race fmt-check mod-check mocks mocks-check fakes-check arch perf-check check pkg install
2
3GOBIN_DIR := $(or $(shell go env GOBIN),$(firstword $(subst :, ,$(shell go env GOPATH)))/bin)
4MOCKERY ?= $(GOBIN_DIR)/mockery
5HEXCHECK ?= $(GOBIN_DIR)/hexcheck
6
7# Build a fresh binary.
8bin:
9	CGO_ENABLED=0 go build -o bin/nefercap ./cmd/nefercap
10build:
11	CGO_ENABLED=0 go build ./...
12test:
13	NEFERCAP_REQUIRE_WAYLAND=1 CGO_ENABLED=0 go test ./...
14vet:
15	CGO_ENABLED=0 go vet ./...
16race:
17	# cgo is enabled only for the race test binary.
18	NEFERCAP_REQUIRE_WAYLAND=1 CGO_ENABLED=1 go test -race ./...
19# Go sources must be gofmt-clean (lists the offending files and fails otherwise).
20fmt-check:
21	test -z "$$(gofmt -l ./internal ./cmd)" || { gofmt -l ./internal ./cmd >&2; exit 1; }
22# go.mod and go.sum must be tidy (prints the diff and fails otherwise).
23mod-check:
24	go mod tidy -diff
25
26# Regenerate from scratch so mocks of removed interfaces disappear too.
27mocks:
28	@test -x '$(MOCKERY)' || { echo 'mockery not found or not executable: $(MOCKERY)' >&2; exit 1; }
29	rm -rf internal/mocks
30	find internal -name '*_mock_test.go' -delete
31	$(MOCKERY)
32
33MOCKS := internal/mocks ':(glob)internal/**/*_mock_test.go'
34# Regenerate, then require the mocks to be tracked and unchanged.
35mocks-check: mocks
36	git diff --exit-code -- $(MOCKS)
37	@test -z "$$(git ls-files --others --exclude-standard -- $(MOCKS))" || { echo 'untracked generated mocks: commit them' >&2; exit 1; }
38
39# Test doubles come from Mockery only: no handwritten fake/stub/spy types.
40# grep exit 1 (no match) passes; 0 (match) and 2 (error) fail.
41FAKES := ^\s*type\s+\w*(fake|stub|spy|dummy|mock)\w*|^\s*\w*(fake|stub|spy|dummy|mock)\w*(\[[^]]*\])?\s+(struct|interface)\b
42fakes-check:
43	@dirs=$$(ls -d internal cmd 2>/dev/null); [ -n "$$dirs" ] || exit 0; \
44	rc=0; grep -rniE '$(FAKES)' --include='*_test.go' --exclude='*_mock_test.go' $$dirs || rc=$$?; \
45	[ $$rc -eq 1 ] || { [ $$rc -eq 0 ] && echo 'handwritten test double: add an interface and a Mockery entry (see AGENTS.md)' >&2; exit 1; }
46arch:
47	$(HEXCHECK) -hexcheck.config .hexcheck.yaml -hexcheck.root . ./...
48# Steady-state allocation guards. PERF_TESTS lists exact test names and PERF_PKGS
49# the packages holding them. Every named test must exist, so the guard cannot
50# pass vacuously when a frame-path test is removed or renamed.
51PERF_TESTS := TestFrameAllocations TestSelectionAllocations TestPickerAllocations TestMonitorGridAllocations TestMonitorGridPhysicalAllocations TestGridAllocations TestGridModeAllocations TestSelectorAllocations TestModeToggleAllocations TestRefreshAllocations TestVideoRowsAllocations TestWriteSteadyStateAllocations TestResolveOutputAllocations TestCaptureAllocations TestCaptureAllocationsCancellable TestCropAllocations
52PERF_PKGS := ./internal/ports ./internal/core ./internal/adapters/selection ./internal/adapters/indicator ./internal/adapters/ffmpeg ./internal/app ./internal/adapters/wayland
53perf_empty :=
54perf_space := $(perf_empty) $(perf_empty)
55PERF_RE := ^($(subst $(perf_space),|,$(strip $(PERF_TESTS))))$$
56perf-check:
57	@out=$$(CGO_ENABLED=0 go test -list '$(PERF_RE)' $(PERF_PKGS)) || { echo "$$out" >&2; exit 1; }; \
58	for t in $(PERF_TESTS); do \
59		printf '%s\n' "$$out" | grep -qx "$$t" || { echo "perf-check: test $$t not found in $(PERF_PKGS)" >&2; exit 1; }; \
60	done
61	NEFERCAP_REQUIRE_WAYLAND=1 CGO_ENABLED=0 go test $(PERF_PKGS) -run '$(PERF_RE)' -count=1
62check: fmt-check mod-check vet test arch fakes-check perf-check
63
64# Arch package of the committed HEAD (packaging/arch/PKGBUILD). Go modules
65# come from the module proxy in prepare(); the build itself runs offline.
66# pacman-ordered version: 0.0.0.r<commits>.g<hash>; a tag replaces 0.0.0.
67pkg: SHELL := bash
68pkg: .SHELLFLAGS := -eo pipefail -c
69pkg:
70	@test -z "$$(git status --porcelain)" || echo "warning: uncommitted changes are not packaged" >&2
71	v=$$(t=$$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//; s/-/_/g'); \
72		echo "$${t:-0.0.0}.r$$(git rev-list --count HEAD).g$$(git rev-parse --short HEAD)"); \
73	d=$$(mktemp -d /tmp/nefercap-pkg.XXXXXX); trap 'rm -rf "$$d"' EXIT; \
74	git archive --prefix=nefercap-$$v/ -o "$$d/nefercap-$$v.tar.gz" HEAD; \
75	cp packaging/arch/PKGBUILD "$$d/"; \
76	cd "$$d" && sed -i "s/^pkgver=.*/pkgver=$$v/; s/^sha256sums=.*/sha256sums=('$$(sha256sum *.tar.gz | cut -d' ' -f1)')/" PKGBUILD; \
77	makepkg -f --noconfirm; mkdir -p $(CURDIR)/dist; rm -f $(CURDIR)/dist/nefercap-*.pkg.tar.zst; mv *.pkg.tar.zst $(CURDIR)/dist/
78	@ls dist/*.pkg.tar.zst
79
80# Build the package, then install it with pacman (asks for sudo).
81install: pkg
82	sudo pacman -U dist/nefercap-*.pkg.tar.zst

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 2

Tags 9

↑↓ moveenter openesc close