gochatterminal

package
v0.0.0-...-7b52f40 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InputRequest

type InputRequest struct {
	Prompt   string
	Response chan string
}

InputRequest represents a request for user input.

type Terminal

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

Terminal struct handles user input and terminal state

func NewTerminal

func NewTerminal(prompt string) (*Terminal, error)

NewTerminal initializes a new Terminal instance.

func (*Terminal) AskYesNo

func (t *Terminal) AskYesNo(prompt string) bool

AskYesNo prompts the user with a question and expects a yes/no response.

func (*Terminal) Close

func (t *Terminal) Close()

Close terminates the input manager goroutine and restores terminal state.

func (*Terminal) PrintMessage

func (t *Terminal) PrintMessage(message string, restorePrompt bool)

PrintMessage prints a message to the terminal in a thread-safe manner.

func (*Terminal) ReadLine

func (t *Terminal) ReadLine() (string, error)

ReadLine reads a line from the terminal using the default prompt.

func (*Terminal) ReadLineWithPrompt

func (t *Terminal) ReadLineWithPrompt(prompt string) (string, error)

ReadLineWithPrompt reads a line using a specified prompt.

func (*Terminal) RestoreState

func (t *Terminal) RestoreState() error

func (*Terminal) SetPrompt

func (t *Terminal) SetPrompt(prompt string)

SetPrompt updates the terminal prompt.

func (*Terminal) SetRawMode

func (t *Terminal) SetRawMode() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳