Skip to content

Commit

Permalink
fix: strip ansi sequences from stdin (#739)
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
  • Loading branch information
caarlos0 authored Dec 9, 2024
1 parent 71d7e65 commit fb543c3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/stdin/stdin.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"io"
"os"
"strings"

"github.com/charmbracelet/x/ansi"
)

// Read reads input from an stdin pipe.
Expand All @@ -28,7 +30,7 @@ func Read() (string, error) {
}
}

return strings.TrimSuffix(b.String(), "\n"), nil
return strings.TrimSuffix(ansi.Strip(b.String()), "\n"), nil
}

// IsEmpty returns whether stdin is empty.
Expand Down

0 comments on commit fb543c3

Please sign in to comment.