mirror of
https://github.com/charmbracelet/gum
synced 2024-06-15 20:15:08 +02:00
fix: Make --select-if-one print to stdout (#463)
For some reason it wasn't printing to stdout (and I could repro that bug even on versions before I added the newline). It was only showing up on other streams in the shell (error stream probably), not getting sent into pipes. I changed it to fmt.Println. As for the ansi-stripping that was in `filter`, LMK if that's what you prefer and I'll add it to `choose` too. I just wanted them to match.
This commit is contained in:
parent
d1145b4163
commit
a11d1ff648
|
@ -34,8 +34,7 @@ func (o Options) Run() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if o.SelectIfOne && len(o.Options) == 1 {
|
if o.SelectIfOne && len(o.Options) == 1 {
|
||||||
print(o.Options[0])
|
fmt.Println(o.Options[0])
|
||||||
print("\n")
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,12 +44,7 @@ func (o Options) Run() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if o.SelectIfOne && len(o.Options) == 1 {
|
if o.SelectIfOne && len(o.Options) == 1 {
|
||||||
if isatty.IsTerminal(os.Stdout.Fd()) {
|
fmt.Println(o.Options[0])
|
||||||
fmt.Print(o.Options[0])
|
|
||||||
} else {
|
|
||||||
fmt.Print(ansi.Strip(o.Options[0]))
|
|
||||||
}
|
|
||||||
print("\n")
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue