fix(input): Avoid reading from stdin if --value is being used (#448)

This commit is contained in:
Piero Lescano 2023-11-14 16:54:45 -05:00 committed by GitHub
parent eb0e8afeba
commit dd557baf6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,10 +18,10 @@ import (
// https://github.com/charmbracelet/bubbles/textinput
func (o Options) Run() error {
i := textinput.New()
if in, _ := stdin.Read(); in != "" && o.Value == "" {
i.SetValue(in)
} else {
if o.Value != "" {
i.SetValue(o.Value)
} else if in, _ := stdin.Read(); in != "" {
i.SetValue(in)
}
i.Focus()