Help us shape the future of Go! Take the 2026 Go Developer Survey

stdin

package
v0.2.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package stdin reads the terminal once for a whole run or chat.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lines

type Lines struct {
	// contains filtered or unexported fields
}

Lines is the one reader of stdin. Each line typed goes out on C, to whoever is listening at the time: steering while a turn runs and, in a chat, the prompt between turns. C is unbuffered, so a line typed while nobody listens waits for the next listener instead of being lost.

func NewLines

func NewLines(in io.Reader, stderr io.Writer) *Lines

func (*Lines) C

func (l *Lines) C() <-chan string

C is the channel of typed lines. It is closed when stdin ends.

func (*Lines) Read

func (l *Lines) Read(ctx context.Context)

Read sends each line on C until stdin ends or ctx ends. Scan blocks on stdin and cannot be cancelled, so this goroutine can outlive the session; the process exits right after, so that is harmless.

type None

type None struct{}

None is used when nobody is at a terminal: nothing reads stdin.

func (None) Read

func (None) Read(context.Context)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL