blob: 7e38d30aea4f6d11be2a2d3d876770914dd2d51a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
package main
import (
"citrons.xyz/talk/tui"
)
type loginPrompt struct {
input tui.TextInput
username string
}
func (p *loginPrompt) Input() *tui.TextInput {
return &p.input
}
func (p *loginPrompt) Send(text string) {
if p.username != "" {
return
}
p.username = text
globalApp.auth(text, func(success bool) {
if success {
globalApp.removePrompt(p)
} else {
p.username = ""
}
})
}
func (p *loginPrompt) ShowStatusLine() {
tui.Text("[", nil)
tui.Text("login", &tui.Style {
Bg: tui.White, Fg: tui.Blue, Bold: true,
})
tui.Text("]", nil)
tui.Text(" username:", nil)
}
|