main 6af0a61

repos.go RawHistoryFolder

1package models
2
3// AURHelperOption represents a selectable AUR helper option.
4type AURHelperOption struct {
5	Value       string
6	Label       string
7	Description string
8	Recommended bool
9}
10
11// ReposModelImpl holds AUR helper selection state.
12// Chaotic-AUR is always enabled — not user-configurable.
13type ReposModelImpl struct {
14	aurOptions  []AURHelperOption
15	aurSelected int // which AUR item is selected (confirmed)
16	cursor      int // flat index across all items
17}
18
19// NewReposModel creates a new repos selection model.
20func NewReposModel() *ReposModelImpl {
21	aurOptions := []AURHelperOption{
22		{Value: "paru", Label: "paru", Description: "Fast AUR helper written in Rust (recommended)", Recommended: true},
23		{Value: "yay", Label: "yay", Description: "Yet Another Yogurt - AUR helper written in Go"},
24	}
25	aurSelected := 0
26	for i, o := range aurOptions {
27		if o.Recommended {
28			aurSelected = i
29			break
30		}
31	}
32
33	return &ReposModelImpl{
34		aurOptions:  aurOptions,
35		aurSelected: aurSelected,
36		cursor:      0,
37	}
38}
39
40// CursorIndex returns the current flat cursor position.
41func (rm *ReposModelImpl) CursorIndex() int { return rm.cursor }
42
43// AUROptions returns the selectable AUR helper options.
44func (rm *ReposModelImpl) AUROptions() []AURHelperOption { return rm.aurOptions }
45
46// AURSelectedIndex returns the confirmed AUR selection index.
47func (rm *ReposModelImpl) AURSelectedIndex() int { return rm.aurSelected }
48
49// SelectedAURHelper returns the selected AUR helper value string.
50func (rm *ReposModelImpl) SelectedAURHelper() string {
51	if len(rm.aurOptions) == 0 {
52		return "paru"
53	}
54	if rm.aurSelected < 0 || rm.aurSelected >= len(rm.aurOptions) {
55		return rm.aurOptions[0].Value
56	}
57	return rm.aurOptions[rm.aurSelected].Value
58}
59
60// MoveUp moves the cursor up.
61func (rm *ReposModelImpl) MoveUp() {
62	if rm.cursor > 0 {
63		rm.cursor--
64	}
65}
66
67// MoveDown moves the cursor down.
68func (rm *ReposModelImpl) MoveDown() {
69	if rm.cursor < len(rm.aurOptions)-1 {
70		rm.cursor++
71	}
72}
73
74// Select confirms the item currently under the cursor.
75func (rm *ReposModelImpl) Select() {
76	if rm.cursor < len(rm.aurOptions) {
77		rm.aurSelected = rm.cursor
78	}
79}

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