From 533a1b0f6974a7002c27aab93fd5d3a524801faf Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Thu, 11 May 2023 01:47:28 +0200 Subject: [PATCH] chore: use nil input when stdin is a pipe --- main.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/main.go b/main.go index 536b14aa..1b732755 100644 --- a/main.go +++ b/main.go @@ -143,12 +143,6 @@ func buildVersion() string { return result } -type noopRead struct{} - -func (nr noopRead) Read(_ []byte) (n int, err error) { - return 0, nil -} - func main() { flag.Usage = usage flag.CommandLine.SortFlags = false @@ -164,7 +158,7 @@ func main() { renderer := lipgloss.NewRenderer(os.Stderr, termenv.WithColorCache(true)) opts := []tea.ProgramOption{tea.WithOutput(renderer.Output())} if !isatty.IsTerminal(os.Stdin.Fd()) { - opts = append(opts, tea.WithInput(noopRead{})) + opts = append(opts, tea.WithInput(nil)) } p := tea.NewProgram(newMods(config, renderer), opts...) m, err := p.Run()