0.1.21 fbfa93c

run.go RawHistoryFolder

1package mvu
2
3import (
4	"fmt"
5	"net/http"
6	"os"
7
8	tea "github.com/charmbracelet/bubbletea"
9)
10
11// RunDeploymentTUI runs the complete deployment TUI and returns the final model
12func RunDeploymentTUI(client *http.Client, imageName, targetDomain, port string) (SpinnerModel, error) {
13	m := NewSpinnerModel()
14	m.deployment.imageName = imageName
15	m.deployment.targetDomain = targetDomain
16	m.deployment.port = port
17	m.deployment.client = client
18
19	p := tea.NewProgram(m)
20	modelInterface, err := p.Run()
21	if err != nil {
22		return SpinnerModel{}, fmt.Errorf("error running TUI program: %w", err)
23	}
24
25	finalModel, ok := modelInterface.(SpinnerModel)
26	if !ok {
27		return SpinnerModel{}, fmt.Errorf("could not type assert tea model to concrete type")
28	}
29
30	return finalModel, nil
31}
32
33// RunProgressBarTUI runs the progress bar TUI and returns the final model
34func RunProgressBarTUI(ProgressCh <-chan ProgressMsg) (*Model, error) {
35	m := NewPBModel()
36	p := tea.NewProgram(&m)
37	// Start a goroutine that updates the progress bar as percentages are received on the channel.
38	go func() {
39		for percent := range ProgressCh {
40			p.Send(ProgressMsg(percent))
41		}
42	}()
43
44	if _, err := p.Run(); err != nil {
45		fmt.Println("Error running progress bar TUI:", err)
46		os.Exit(1)
47	}
48
49	return &m, nil
50}

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 7

Tags 106

↑↓ moveenter openesc close