terminal

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Error = color.Red

Functions

This section is empty.

Types

type IO

type IO struct {
	Reader  *readline.Instance
	Prompt  *Prompt
	Spinner *Spinner

	Config *IOConfig
	// contains filtered or unexported fields
}

IO encapsulates input/output operations.

func NewIO

func NewIO(config *IOConfig) (*IO, error)

NewIO returns a new IO based on the provided configuration.

func (*IO) Read

func (io *IO) Read() string

Read reads input from the underlying source and returns it as a string. If multiline is true, it reads all available lines; otherwise, it reads a single line.

func (*IO) SetUserPrompt

func (io *IO) SetUserPrompt()

SetUserPrompt sets the terminal prompt according to the current input mode.

func (*IO) Write

func (io *IO) Write(data string)

Write writes the given string data to the underlying data stream.

type IOConfig

type IOConfig struct {
	User           string
	Multiline      bool
	LineTerminator string
}

IOConfig represents the configuration settings for IO.

type Prompt

type Prompt struct {
	User              string
	UserMultiline     string
	UserMultilineNext string
	Gemini            string
	Cli               string
}

func NewPrompt

func NewPrompt(currentUser string) *Prompt

type Spinner

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

Spinner is a visual indicator of progress displayed in the terminal as a scrolling dot animation.

func NewSpinner

func NewSpinner(w io.Writer, interval time.Duration, length int) *Spinner

NewSpinner returns a new Spinner.

func (*Spinner) Clear

func (s *Spinner) Clear()

func (*Spinner) Start

func (s *Spinner) Start()

func (*Spinner) Stop

func (s *Spinner) Stop()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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