summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnan <sandra.snan@idiomdrottning.org>2023-12-10 19:52:11 +0100
committerGitHub <noreply@github.com>2023-12-10 13:52:11 -0500
commita11d1ff648959d8354a0bcb78366bb78492d6b2e (patch)
tree765967d1233d1ac3d729b1cd121a38c0c264ea6d
parentd1145b416387749dfa815ebc0e3494e586cc999a (diff)
fix: Make --select-if-one print to stdout (#463)v0.13.0
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.
-rw-r--r--choose/command.go3
-rw-r--r--filter/command.go7
2 files changed, 2 insertions, 8 deletions
diff --git a/choose/command.go b/choose/command.go
index ede9338..66691d8 100644
--- a/choose/command.go
+++ b/choose/command.go
@@ -34,8 +34,7 @@ func (o Options) Run() error {
}
if o.SelectIfOne && len(o.Options) == 1 {
- print(o.Options[0])
- print("\n")
+ fmt.Println(o.Options[0])
return nil
}
diff --git a/filter/command.go b/filter/command.go
index 95569b2..f4af719 100644
--- a/filter/command.go
+++ b/filter/command.go
@@ -44,12 +44,7 @@ func (o Options) Run() error {
}
if o.SelectIfOne && len(o.Options) == 1 {
- if isatty.IsTerminal(os.Stdout.Fd()) {
- fmt.Print(o.Options[0])
- } else {
- fmt.Print(ansi.Strip(o.Options[0]))
- }
- print("\n")
+ fmt.Println(o.Options[0])
return nil
}