mirror of
https://github.com/varbhat/torpar.git
synced 2021-08-02 01:37:31 +03:00
44 lines
784 B
Go
44 lines
784 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/jroimartin/gocui"
|
|
)
|
|
|
|
func main() {
|
|
// Generate tracker part of Magnet URL in another goroutine
|
|
go gentrackers()
|
|
|
|
// Start our TUI - new gocui instance
|
|
tui, err := gocui.NewGui(gocui.OutputNormal)
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
os.Exit(1)
|
|
}
|
|
defer tui.Close()
|
|
|
|
tui.Cursor = true // Enable cursor
|
|
if len(query) > 0 {
|
|
if err := torparadise(tui); err != nil {
|
|
fmt.Println(err)
|
|
os.Exit(1)
|
|
}
|
|
} else {
|
|
tui.SetManagerFunc(searchui) // Layout is handled by Mainlayout function
|
|
}
|
|
|
|
if err := tui.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, quit); err != nil {
|
|
fmt.Println(err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
if err := tui.MainLoop(); err != nil && err != gocui.ErrQuit {
|
|
fmt.Println(err)
|
|
os.Exit(1)
|
|
}
|
|
tui.Close()
|
|
|
|
}
|