feat: use bubbletea framework
- implement TUI in bubbletea - split components into separate files - remove now unused functions - restructure files
This commit is contained in:
parent
9656db5335
commit
8a0ef32c91
14 changed files with 269 additions and 187 deletions
|
@ -2,7 +2,6 @@ package websocket
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/charmbracelet/log"
|
||||
"github.com/gorilla/websocket"
|
||||
|
||||
|
@ -11,7 +10,8 @@ import (
|
|||
|
||||
var Done = make(chan struct{})
|
||||
|
||||
// Receives websocket messages and write them to `channel`
|
||||
// Receives websocket messages and writes them to a channel.
|
||||
// Closes the channel if websocket closes.
|
||||
func (c Client) ProcessServerMessages(channel chan<- GoTomato.ServerMessage) {
|
||||
var serverMessage GoTomato.ServerMessage
|
||||
|
||||
|
@ -25,8 +25,8 @@ func (c Client) ProcessServerMessages(channel chan<- GoTomato.ServerMessage) {
|
|||
return
|
||||
}
|
||||
// Log any other errors
|
||||
fmt.Println()
|
||||
log.Error("Read error!", "reason", err)
|
||||
close(channel)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue