main 6af0a61

repos.go RawHistoryFolder

1package views
2
3import (
4	"strings"
5
6	"github.com/bnema/archup/internal/interfaces/tui/models"
7	"github.com/charmbracelet/lipgloss"
8)
9
10// RenderReposSelection renders the AUR helper selection screen.
11// Chaotic-AUR is always enabled and not shown as an option.
12func RenderReposSelection(rm *models.ReposModelImpl) string {
13	var b strings.Builder
14
15	title := lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("12"))
16	info := lipgloss.NewStyle().Foreground(lipgloss.Color("8"))
17	section := lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("14"))
18	desc := lipgloss.NewStyle().Foreground(lipgloss.Color("8")).Faint(true)
19
20	cursorStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("10")).Bold(true)
21	selectedMark := lipgloss.NewStyle().Foreground(lipgloss.Color("10")).Bold(true)
22	normalMark := lipgloss.NewStyle().Foreground(lipgloss.Color("8"))
23
24	b.WriteString("\n")
25	b.WriteString(title.Render("Repository Configuration"))
26	b.WriteString("\n\n")
27
28	b.WriteString(section.Render("AUR Helper"))
29	b.WriteString("\n")
30
31	for i, option := range rm.AUROptions() {
32		isCursor := rm.CursorIndex() == i
33		isSelected := rm.AURSelectedIndex() == i
34
35		if isSelected {
36			b.WriteString(selectedMark.Render(" [x] "))
37		} else {
38			b.WriteString(normalMark.Render(" [ ] "))
39		}
40
41		label := option.Label
42		if isCursor {
43			b.WriteString(cursorStyle.Render("> " + label))
44		} else {
45			b.WriteString(label)
46		}
47		b.WriteString("\n")
48		b.WriteString(desc.Render("      " + option.Description))
49		b.WriteString("\n")
50	}
51
52	b.WriteString("\n")
53	b.WriteString(desc.Render("  Chaotic-AUR is always enabled (pre-built AUR packages)"))
54	b.WriteString("\n\n")
55	b.WriteString(info.Render("↑/↓ move • ←/→ or space select • enter confirm • esc back"))
56
57	return b.String()
58}

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