-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
34 lines (27 loc) · 671 Bytes
/
main.go
File metadata and controls
34 lines (27 loc) · 671 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
package main
import (
"fmt"
"os"
"github.com/charmbracelet/bubbletea"
"github.com/fulgidus/revoco/cmd"
"github.com/fulgidus/revoco/plugins"
"github.com/fulgidus/revoco/tui"
)
func main() {
// Ensure plugins are cleaned up on exit
defer plugins.ShutdownPlugins()
// Set version info for CLI
cmd.SetVersionInfo(VersionInfo, FullVersionInfo)
// If invoked with no arguments, launch the TUI.
if cmd.NeedsTUI() {
app := tui.NewApp()
p := tea.NewProgram(app, tea.WithAltScreen())
if _, err := p.Run(); err != nil {
fmt.Fprintf(os.Stderr, "TUI error: %v\n", err)
os.Exit(1)
}
return
}
// Otherwise let Cobra handle the CLI.
cmd.Execute()
}