I would like to predict not hardcoded options but pull them from daemon every time.
For example I input command app user remove, click TAB, and cli would offer me list of users which pulled by calling exec.Command("cli-get-users')
type ppred struct{}
func (y ppred) Predict(prefix string) []string {
dateCmd := exec.Command("app", "user", "list")
dateOut, err := dateCmd.Output()
if err != nil {
// handle error
}
s := strings.Split(strings.TrimSpace(string(dateOut)), "\n")
return predict.Set(s).Predict(prefix)
}
Output is always empty, but when I run this code inside unit test, output is present and we're all good.
If this is expected behaviour please someone explain or point me to explanation why it's not working.
I would like to predict not hardcoded options but pull them from daemon every time.
For example I input command
app user remove, click TAB, and cli would offer me list of users which pulled by calling exec.Command("cli-get-users')Output is always empty, but when I run this code inside unit test, output is present and we're all good.
If this is expected behaviour please someone explain or point me to explanation why it's not working.