v0.23.2 bfd5eb4

updater.go RawHistoryFolder

1// Package port defines interfaces for external dependencies.
2package port
3
4import (
5	"context"
6
7	"github.com/bnema/dumber/internal/domain/entity"
8)
9
10// UpdateChecker checks for available updates from a remote source.
11type UpdateChecker interface {
12	// CheckForUpdate compares the current version with the latest available release.
13	// Returns update info including whether a newer version is available.
14	CheckForUpdate(ctx context.Context, currentVersion string) (*entity.UpdateInfo, error)
15}
16
17// UpdateDownloader downloads and extracts update archives.
18type UpdateDownloader interface {
19	// Download fetches the update archive to the specified destination directory.
20	// Returns the path to the downloaded archive file.
21	Download(ctx context.Context, downloadURL string, destDir string) (archivePath string, err error)
22
23	// Extract extracts the binary from the downloaded archive.
24	// Returns the path to the extracted binary.
25	Extract(ctx context.Context, archivePath string, destDir string) (binaryPath string, err error)
26}
27
28// SelfUpdateBlockedReason indicates why self-update is not available.
29type SelfUpdateBlockedReason string
30
31const (
32	// SelfUpdateAllowed means self-update is possible.
33	SelfUpdateAllowed SelfUpdateBlockedReason = ""
34	// SelfUpdateBlockedFlatpak means updates are managed by Flatpak.
35	SelfUpdateBlockedFlatpak SelfUpdateBlockedReason = "flatpak"
36	// SelfUpdateBlockedPacman means updates are managed by pacman/AUR.
37	SelfUpdateBlockedPacman SelfUpdateBlockedReason = "pacman"
38	// SelfUpdateBlockedNotWritable means the binary is not writable.
39	SelfUpdateBlockedNotWritable SelfUpdateBlockedReason = "not_writable"
40)
41
42// UpdateApplier stages and applies updates.
43type UpdateApplier interface {
44	// CanSelfUpdate checks if the current binary is writable by the current user.
45	// Returns true if auto-update is possible, false if user lacks write permission.
46	CanSelfUpdate(ctx context.Context) bool
47
48	// SelfUpdateBlockedReason returns why self-update is blocked, or empty if allowed.
49	SelfUpdateBlockedReason(ctx context.Context) SelfUpdateBlockedReason
50
51	// GetBinaryPath returns the path to the currently running binary.
52	GetBinaryPath() (string, error)
53
54	// StageUpdate prepares the new binary to be applied on exit.
55	// The staged update will be applied when ApplyOnExit is called.
56	StageUpdate(ctx context.Context, newBinaryPath string) error
57
58	// HasStagedUpdate checks if there is an update staged and ready to apply.
59	HasStagedUpdate(ctx context.Context) bool
60
61	// ApplyOnExit replaces the current binary with the staged update.
62	// This should be called during graceful shutdown.
63	// Returns the path to the backup of the old binary.
64	ApplyOnExit(ctx context.Context) (backupPath string, err error)
65
66	// ClearStagedUpdate removes any staged update without applying it.
67	ClearStagedUpdate(ctx context.Context) error
68}

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 8

Tags 42

↑↓ moveenter openesc close