sway/run_command.go
2024-02-14 16:48:50 +01:00

16 lines
328 B
Go

package sway
import (
"git.milar.in/milarin/slices"
)
func (c *Client) RunCommand(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
}