mirror of
https://github.com/charmbracelet/gum
synced 2024-06-09 01:02:17 +02:00
fix(input): Avoid reading from stdin if --value
is being used (#448)
This commit is contained in:
parent
eb0e8afeba
commit
dd557baf6a
|
@ -18,10 +18,10 @@ import (
|
||||||
// https://github.com/charmbracelet/bubbles/textinput
|
// https://github.com/charmbracelet/bubbles/textinput
|
||||||
func (o Options) Run() error {
|
func (o Options) Run() error {
|
||||||
i := textinput.New()
|
i := textinput.New()
|
||||||
if in, _ := stdin.Read(); in != "" && o.Value == "" {
|
if o.Value != "" {
|
||||||
i.SetValue(in)
|
|
||||||
} else {
|
|
||||||
i.SetValue(o.Value)
|
i.SetValue(o.Value)
|
||||||
|
} else if in, _ := stdin.Read(); in != "" {
|
||||||
|
i.SetValue(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
i.Focus()
|
i.Focus()
|
||||||
|
|
Loading…
Reference in a new issue