sampler-fork/data/item.go

25 lines
407 B
Go
Raw Normal View History

2019-01-31 23:40:05 +00:00
package data
import (
ui "github.com/sqshq/termui"
2019-01-31 23:40:05 +00:00
"os/exec"
"strings"
)
type Item struct {
Script string `yaml:"script"`
Label string `yaml:"label"`
Color ui.Color `yaml:"color"`
2019-01-31 23:40:05 +00:00
}
func (self *Item) nextValue() (value string, err error) {
output, err := exec.Command("sh", "-c", self.Script).Output()
if err != nil {
return "", err
}
return strings.TrimSpace(string(output)), nil
}