Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
16d2e8e8fd | |||
713a6bd6be | |||
580b7d5a3a |
2
do.go
2
do.go
@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func (c *Client) Action(action Action) error {
|
||||
func (c *Client) DoAction(action Action) error {
|
||||
// print request and response to console:
|
||||
//
|
||||
// io.Copy(os.Stdout, asJsonReader(action))
|
||||
|
@ -7,7 +7,7 @@ type WorkspaceID int
|
||||
type Workspace struct {
|
||||
ID WorkspaceID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Output string `json:"output"`
|
||||
Output OutputName `json:"output"`
|
||||
Urgent bool `json:"is_urgent"`
|
||||
Active bool `json:"is_active"`
|
||||
Focused bool `json:"is_focused"`
|
||||
|
4
utils.go
4
utils.go
@ -77,9 +77,11 @@ func readSocketGeneric[T any](ctx context.Context, socket string, body io.Reader
|
||||
defer close(out)
|
||||
defer r.Close()
|
||||
|
||||
dec := json.NewDecoder(r)
|
||||
|
||||
for ctx.Err() == nil {
|
||||
value := new(T)
|
||||
if err := json.NewDecoder(r).Decode(value); err != nil {
|
||||
if err := dec.Decode(value); err != nil {
|
||||
if errors.Is(err, io.EOF) {
|
||||
return
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user