18 lines
361 B
Go
18 lines
361 B
Go
package sway
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.milar.in/milarin/slices"
|
|
)
|
|
|
|
func (c *Client) RunCommand(ctx context.Context, cmd string) ([]error, error) {
|
|
results, err := sendMessage[[]commandResult](c, 0, cmd)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
errors := slices.Map(slices.Filter(results, commandResult.HasError), commandResult.GetError)
|
|
return errors, nil
|
|
}
|