main 6af0a61

repository.go RawHistoryFolder

1package packages
2
3import "errors"
4
5// AURHelper represents AUR helper tool choice
6type AURHelper int
7
8const (
9	// AURHelperParu is the paru AUR helper
10	AURHelperParu AURHelper = iota
11
12	// AURHelperYay is the yay AUR helper
13	AURHelperYay
14)
15
16// String returns the AUR helper package name
17func (a AURHelper) String() string {
18	switch a {
19	case AURHelperYay:
20		return "yay"
21	default:
22		return "paru"
23	}
24}
25
26// Repository is an immutable value object for repository configuration.
27// Chaotic-AUR is always enabled.
28type Repository struct {
29	enableMultilib bool
30	aurHelper      AURHelper
31}
32
33// NewRepository creates a new Repository value object
34func NewRepository(enableMultilib bool, aurHelper AURHelper) (*Repository, error) {
35	if aurHelper < AURHelperParu || aurHelper > AURHelperYay {
36		return nil, errors.New("invalid AUR helper")
37	}
38
39	return &Repository{
40		enableMultilib: enableMultilib,
41		aurHelper:      aurHelper,
42	}, nil
43}
44
45// EnableMultilib returns true if multilib is enabled
46func (r *Repository) EnableMultilib() bool {
47	return r.enableMultilib
48}
49
50// AURHelper returns the AUR helper choice
51func (r *Repository) AURHelper() AURHelper {
52	return r.aurHelper
53}
54
55// String returns human-readable representation
56func (r *Repository) String() string {
57	return "Repository(multilib=" + boolToStr(r.enableMultilib) +
58		", chaotic=true" +
59		", aur=" + r.aurHelper.String() + ")"
60}
61
62// Equals checks if two Repository objects are equal
63func (r *Repository) Equals(other *Repository) bool {
64	if other == nil {
65		return false
66	}
67	return r.enableMultilib == other.enableMultilib &&
68		r.aurHelper == other.aurHelper
69}
70
71func boolToStr(b bool) string {
72	if b {
73		return "true"
74	}
75	return "false"
76}

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 1

Tags 0

    ↑↓ moveenter openesc close