-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
43 lines (36 loc) · 845 Bytes
/
main.go
File metadata and controls
43 lines (36 loc) · 845 Bytes
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
38
39
40
41
42
43
package main
import (
"context"
"fmt"
"io"
"os"
"os/signal"
"syscall"
tea "github.com/charmbracelet/bubbletea"
"gopass-tui/internal/gopass"
"gopass-tui/internal/ui"
)
func main() {
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
service := gopass.NewService()
if err := gopass.BootstrapStore(ctx, service, gopass.StartupIO{
Stdin: os.Stdin,
Stdout: os.Stdout,
Stderr: os.Stderr,
UnlockOut: io.Discard,
}); err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
model, err := ui.NewModel(service)
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
program := tea.NewProgram(model, tea.WithAltScreen())
if _, err := program.Run(); err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
}