detached 86b12d7

New vhs for 0.1 release

commit
86b12d7ccb4a6f6e032f0a69d5e5f4adcada24f5
author
bnema · · 2023-11-09 15:12 UTC
parent
d8a0f1d
signature
unsigned
7 files · +55 -36
D assets/vhs/demo.gif +0 -0 binary file: no text diff

binary file: no text diff

M assets/vhs/demo.tape +4 -5
@@ -56,6 +56,7 @@ Output demo.gif
5656
5757 Require echo
5858 Require gordon
59+Require curl
5960
6061 Set TypingSpeed 75ms
6162 Set Shell "bash"
@@ -80,12 +81,10 @@ Type "-t hello.bamen.dev"
8081 Sleep 1
8182 Enter
8283
83-Sleep 10
84-
85-Type "curl"
84+Sleep 15
85+Enter
86+Type "curl https://hello.bamen.dev"
8687 Sleep 1
87-Space
88-Type "https://hello.bamen.dev"
8988 Enter
9089
9190 Sleep 10
@@ -56,6 +56,7 @@ Output demo.gif
56 56
57 Require echo57 Require echo
58 Require gordon58 Require gordon
59+Require curl
59 60
60 Set TypingSpeed 75ms61 Set TypingSpeed 75ms
61 Set Shell "bash"62 Set Shell "bash"
@@ -80,12 +81,10 @@ Type "-t hello.bamen.dev"
80 Sleep 181 Sleep 1
81 Enter82 Enter
82 83
83-Sleep 1084+Sleep 15
84-85+Enter
85-Type "curl"86+Type "curl https://hello.bamen.dev"
86 Sleep 187 Sleep 1
87-Space
88-Type "https://hello.bamen.dev"
89 Enter88 Enter
90 89
91 Sleep 1090 Sleep 10
A assets/vhs/demo_deploy.gif +0 -0 binary file: no text diff

binary file: no text diff

M go.mod +0 -1
@@ -8,7 +8,6 @@ require (
88 github.com/charmbracelet/bubbles v0.16.1
99 github.com/charmbracelet/bubbletea v0.24.1
1010 github.com/charmbracelet/lipgloss v0.7.1
11- github.com/cheggaaa/pb v1.0.29
1211 github.com/docker/docker v24.0.6+incompatible
1312 github.com/docker/go-connections v0.4.0
1413 github.com/fatih/color v1.15.0
@@ -8,7 +8,6 @@ require (
8 github.com/charmbracelet/bubbles v0.16.18 github.com/charmbracelet/bubbles v0.16.1
9 github.com/charmbracelet/bubbletea v0.24.19 github.com/charmbracelet/bubbletea v0.24.1
10 github.com/charmbracelet/lipgloss v0.7.110 github.com/charmbracelet/lipgloss v0.7.1
11- github.com/cheggaaa/pb v1.0.29
12 github.com/docker/docker v24.0.6+incompatible11 github.com/docker/docker v24.0.6+incompatible
13 github.com/docker/go-connections v0.4.012 github.com/docker/go-connections v0.4.0
14 github.com/fatih/color v1.15.013 github.com/fatih/color v1.15.0
M go.sum +0 -7 generated file: collapsed
M internal/cli/mvu/progressbar.go +1 -23
@@ -1,9 +1,7 @@
11 package mvu
22
33 import (
4- "fmt"
54 "io"
6- "os"
75 "strings"
86
97 "github.com/charmbracelet/bubbles/progress"
@@ -33,7 +31,6 @@ type ProgressReader struct {
3331 }
3432
3533 func NewPBModel() Model {
36- // Gradient from #011E5C to #007BC0
3734 m := progress.New(progress.WithGradient("#007BC0", "#011E5C"))
3835 m.Width = maxWidth
3936
@@ -42,25 +39,6 @@ func NewPBModel() Model {
4239 }
4340 }
4441
45-// Modify RunProgressBarTUI to return a pointer to Model.
46-func RunProgressBarTUI(ProgressCh <-chan ProgressMsg) (*Model, error) {
47- m := NewPBModel()
48- p := tea.NewProgram(&m)
49- // Start a goroutine that updates the progress bar as percentages are received on the channel.
50- go func() {
51- for percent := range ProgressCh {
52- p.Send(ProgressMsg(percent))
53- }
54- }()
55-
56- if _, err := p.Run(); err != nil {
57- fmt.Println("Error running progress bar TUI:", err)
58- os.Exit(1)
59- }
60-
61- return &m, nil // Return a pointer to the model.
62-}
63-
6442 func (pr *ProgressReader) Read(p []byte) (int, error) {
6543 n, err := pr.Reader.Read(p)
6644 if err != nil {
@@ -77,7 +55,7 @@ func (pr *ProgressReader) Close() error {
7755 if closer, ok := pr.Reader.(io.Closer); ok {
7856 return closer.Close()
7957 }
80- return nil // If there's nothing to close, return nil.
58+ return nil
8159 }
8260
8361 func (m Model) Init() tea.Cmd {
@@ -1,9 +1,7 @@
1 package mvu1 package mvu
2 2
3 import (3 import (
4- "fmt"
5 "io"4 "io"
6- "os"
7 "strings"5 "strings"
8 6
9 "github.com/charmbracelet/bubbles/progress"7 "github.com/charmbracelet/bubbles/progress"
@@ -33,7 +31,6 @@ type ProgressReader struct {
33 }31 }
34 32
35 func NewPBModel() Model {33 func NewPBModel() Model {
36- // Gradient from #011E5C to #007BC0
37 m := progress.New(progress.WithGradient("#007BC0", "#011E5C"))34 m := progress.New(progress.WithGradient("#007BC0", "#011E5C"))
38 m.Width = maxWidth35 m.Width = maxWidth
39 36
@@ -42,25 +39,6 @@ func NewPBModel() Model {
42 }39 }
43 }40 }
44 41
45-// Modify RunProgressBarTUI to return a pointer to Model.
46-func RunProgressBarTUI(ProgressCh <-chan ProgressMsg) (*Model, error) {
47- m := NewPBModel()
48- p := tea.NewProgram(&m)
49- // Start a goroutine that updates the progress bar as percentages are received on the channel.
50- go func() {
51- for percent := range ProgressCh {
52- p.Send(ProgressMsg(percent))
53- }
54- }()
55-
56- if _, err := p.Run(); err != nil {
57- fmt.Println("Error running progress bar TUI:", err)
58- os.Exit(1)
59- }
60-
61- return &m, nil // Return a pointer to the model.
62-}
63-
64 func (pr *ProgressReader) Read(p []byte) (int, error) {42 func (pr *ProgressReader) Read(p []byte) (int, error) {
65 n, err := pr.Reader.Read(p)43 n, err := pr.Reader.Read(p)
66 if err != nil {44 if err != nil {
@@ -77,7 +55,7 @@ func (pr *ProgressReader) Close() error {
77 if closer, ok := pr.Reader.(io.Closer); ok {55 if closer, ok := pr.Reader.(io.Closer); ok {
78 return closer.Close()56 return closer.Close()
79 }57 }
80- return nil // If there's nothing to close, return nil.58+ return nil
81 }59 }
82 60
83 func (m Model) Init() tea.Cmd {61 func (m Model) Init() tea.Cmd {
A internal/cli/mvu/run.go +50 -0
@@ -0,0 +1,50 @@
1+package mvu
2+
3+import (
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
12+func 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
34+func 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+}
@@ -0,0 +1,50 @@
1+package mvu
2+
3+import (
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
12+func 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
34+func 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