Documentation
¶
Overview ¶
Package terminal provides a library to interact with ansi/v100 style terminals, readline style. It wraps golang.org/x/term and adds history, prompt, auto-completion and interrupt handling (control-C and signals). It also provides a way to suspend the terminal (restore normal mode) to run sub commands and resume it back to raw mode. It also provides a way to share a single InterruptReader between multiple users of the terminal (for instance both Terminal.ReadLine and AnsiPixels.ReadOrResizeOrSignal can share it). See example/main.go for an example of usage.
Index ¶
- Constants
- Variables
- func CRLFWrite(out io.Writer, buf []byte) (n int, err error)
- func LoggerSetup(out io.Writer)
- func ReadWithTimeout(fd int, tv *unix.Timeval, buf []byte) (int, error)
- func SleepWithContext(ctx context.Context, duration time.Duration) error
- func TimeoutToTimeval(timeout time.Duration) *unix.Timeval
- type AutoCompleteCallback
- type Bufio
- type CRLFWriter
- type FlushWriter
- type FlushableBytesBuffer
- type FlushableStringBuilder
- type InterruptReader
- func (ir *InterruptReader) ChangeTimeout(timeout time.Duration)
- func (ir *InterruptReader) Close() error
- func (ir *InterruptReader) InEOF() bool
- func (ir *InterruptReader) NormalMode() error
- func (ir *InterruptReader) PrimeReadImmediate(p []byte)
- func (ir *InterruptReader) Raw() bool
- func (ir *InterruptReader) RawMode() error
- func (ir *InterruptReader) Read(p []byte) (int, error)
- func (ir *InterruptReader) ReadBlocking(p []byte) (int, error)
- func (ir *InterruptReader) ReadImmediate() (int, error)
- func (ir *InterruptReader) ReadLine() (string, error)
- func (ir *InterruptReader) ReadNonBlocking(p []byte) (int, error)
- func (ir *InterruptReader) ReadWithTimeout(p []byte) (int, error)
- func (ir *InterruptReader) Start(ctx context.Context) (context.Context, context.CancelFunc)
- func (ir *InterruptReader) StartDirect()
- func (ir *InterruptReader) Stop()
- type InterruptedError
- type SyncWriter
- func (w *SyncWriter) Flush() error
- func (w *SyncWriter) Lock()
- func (w *SyncWriter) Unlock()
- func (w *SyncWriter) Write(buf []byte) (n int, err error)
- func (w *SyncWriter) WriteByte(c byte) error
- func (w *SyncWriter) WriteRune(r rune) (n int, err error)
- func (w *SyncWriter) WriteString(s string) (n int, err error)
- type SystemTimeoutReader
- type TermHistory
- type Terminal
- func (t *Terminal) AddToHistory(commands ...string)
- func (t *Terminal) AutoHistory() bool
- func (t *Terminal) Close() error
- func (t *Terminal) History() []string
- func (t *Terminal) IsTerminal() bool
- func (t *Terminal) LastWasPaste() bool
- func (t *Terminal) NewHistory(capacity int)
- func (t *Terminal) ReadLine() (string, error)
- func (t *Terminal) ReplaceLatest(command string) string
- func (t *Terminal) ResetInterrupts(ctx context.Context) (context.Context, context.CancelFunc)
- func (t *Terminal) Resume(ctx context.Context) (context.Context, context.CancelFunc)
- func (t *Terminal) SaveHistory()
- func (t *Terminal) SetAutoCompleteCallback(f AutoCompleteCallback)
- func (t *Terminal) SetAutoHistory(enabled bool)
- func (t *Terminal) SetHistoryFile(f string) error
- func (t *Terminal) SetPrompt(s string)
- func (t *Terminal) Setup(ctx context.Context) error
- func (t *Terminal) Suspend()
- func (t *Terminal) UpdateSize() error
- type TimeoutReader
- func (tr *TimeoutReader) ChangeTimeout(newTimeout time.Duration)
- func (tr *TimeoutReader) Close() error
- func (tr *TimeoutReader) IsClosed() bool
- func (tr *TimeoutReader) PrimeReadImmediate(buf []byte)
- func (tr *TimeoutReader) Read(buf []byte) (int, error)
- func (tr *TimeoutReader) ReadBlocking(buf []byte) (int, error)
- func (tr *TimeoutReader) ReadImmediate() (int, error)
- func (tr *TimeoutReader) ReadWithTimeout(buf []byte) (int, error)
- type TimeoutReaderUnixFD
- func (tr *TimeoutReaderUnixFD) ChangeTimeout(timeout time.Duration)
- func (tr *TimeoutReaderUnixFD) Close() (err error)
- func (tr *TimeoutReaderUnixFD) IsClosed() bool
- func (tr *TimeoutReaderUnixFD) PrimeReadImmediate(buf []byte)
- func (tr *TimeoutReaderUnixFD) Read(buf []byte) (int, error)
- func (tr *TimeoutReaderUnixFD) ReadBlocking(buf []byte) (int, error)
- func (tr *TimeoutReaderUnixFD) ReadImmediate() (int, error)
- func (tr *TimeoutReaderUnixFD) ReadWithTimeout(buf []byte) (int, error)
Constants ¶
const CtrlC = 3 // Control-C is ascii 3 (C is 3rd letter of the alphabet)
const DefaultHistoryCapacity = 99
DefaultHistoryCapacity is the default number of entries in the history (99). History index 1-99 prints using %02d.
const IsUnix = true
Variables ¶
var ( ErrUserInterrupt = NewErrInterrupted("terminal interrupted by user") ErrStopped = NewErrInterrupted("interrupt reader stopped") // not really an error more of a marker. ErrSignal = NewErrInterrupted("signal received") )
var DefaultReaderTimeout = 250 * time.Millisecond
DefaultReaderTimeout is the default timeout for the timeout reader.
var ErrDataTruncated = errors.New("data truncated")
Functions ¶
func LoggerSetup ¶ added in v0.38.0
LoggerSetup sets up fortio logger (and thus stdlib "log" too) to write to the terminal as needed to preserve prompt/work in raw mode (ie add \r before \n). If stderr has been redirected, it doesn't do anything (logs to json in said case).
func ReadWithTimeout ¶ added in v0.17.0
func SleepWithContext ¶ added in v0.8.0
Types ¶
type AutoCompleteCallback ¶
type AutoCompleteCallback func(t *Terminal, line string, pos int, key rune) (newLine string, newPos int, ok bool)
AutoCompleteCallback is called with "this" terminal as first argument so AutoCompleteCallback can use t.Out etc. (compared to the original x/term callback).
type Bufio ¶ added in v0.57.0
type Bufio interface {
FlushWriter
io.StringWriter
io.ByteWriter
WriteRune(r rune) (n int, err error)
}
type CRLFWriter ¶ added in v0.38.0
func (*CRLFWriter) Flush ¶ added in v0.57.0
func (w *CRLFWriter) Flush() error
type FlushWriter ¶ added in v0.57.0
type FlushableBytesBuffer ¶ added in v0.57.0
func (*FlushableBytesBuffer) Flush ¶ added in v0.57.0
func (b *FlushableBytesBuffer) Flush() error
type FlushableStringBuilder ¶ added in v0.57.0
func (*FlushableStringBuilder) Flush ¶ added in v0.57.0
func (b *FlushableStringBuilder) Flush() error
type InterruptReader ¶ added in v0.8.0
type InterruptReader struct {
In *os.File // stdin typically
// contains filtered or unexported fields
}
InterruptReader is a reader that can be interrupted by Ctrl-C or signals. It supports both blocking and non-blocking modes based on the timeout value provided during initialization. When stopped the reads are directly to the underlying timeoutreader.
func GetSharedInput ¶ added in v0.36.0
func GetSharedInput(maxRead time.Duration) *InterruptReader
GetSharedInput returns a shared input that can be used by multiple callers wanting to interact with the terminal in raw mode. For instance both Terminal.ReadLine and AnsiPixels.ReadOrResizeOrSignal can share it. It also changes the timeout for the timeout reader to the maxRead duration if different than before. If 0 timeout is used, it can't be changed later and the reader will block on reads (raw/simple os.Stdin mode).
func NewInterruptReader ¶ added in v0.8.0
NewInterruptReader creates a new interrupt reader. It needs to be Start()ed to start reading from the underlying reader to intercept Ctrl-C and listen for interrupt signals. When not started, it just reads directly from the underlying timeout reader (which can be blocking if timeout is 0). Use GetSharedInput() to get a shared interrupt reader across libraries/caller. Using 0 as the timeout disables most layers and uses the underlying reader directly (blocking IOs). When not in blocking mode, one of [Start] or [StartDirect] must be called after creating it to add the intermediate layer. Note doing it in NewInterruptReader() allows for logger configuration to happen single threaded and thus avoid races.
func (*InterruptReader) ChangeTimeout ¶ added in v0.36.0
func (ir *InterruptReader) ChangeTimeout(timeout time.Duration)
func (*InterruptReader) Close ¶ added in v0.36.0
func (ir *InterruptReader) Close() error
Close restores the terminal to its original state and closes the underlying timeout reader. That ends the polling goroutine in non select OSes/mode but doesn't impact the underlying stream (os.Stdin). It also returns the terminal to normal mode.
func (*InterruptReader) InEOF ¶ added in v0.36.0
func (ir *InterruptReader) InEOF() bool
func (*InterruptReader) NormalMode ¶ added in v0.36.0
func (ir *InterruptReader) NormalMode() error
NormalMode sets the terminal to normal mode. It's a no-op if the terminal is already in normal mode.
func (*InterruptReader) PrimeReadImmediate ¶ added in v0.62.0
func (ir *InterruptReader) PrimeReadImmediate(p []byte)
func (*InterruptReader) Raw ¶ added in v0.36.0
func (ir *InterruptReader) Raw() bool
Raw returns true if the terminal is currently in raw mode.
func (*InterruptReader) RawMode ¶ added in v0.36.0
func (ir *InterruptReader) RawMode() error
RawMode sets the terminal to raw mode. It's a no-op if the terminal is already in raw mode. Must typically defer ir.NormalMode() after calling this to avoid leaving the terminal in raw mode upon exit/panic.
func (*InterruptReader) Read ¶ added in v0.8.0
func (ir *InterruptReader) Read(p []byte) (int, error)
Read implements io.Reader interface.
func (*InterruptReader) ReadBlocking ¶ added in v0.59.0
func (ir *InterruptReader) ReadBlocking(p []byte) (int, error)
ReadBlocking reads from the underlying reader in blocking mode (without timeout).
func (*InterruptReader) ReadImmediate ¶ added in v0.59.0
func (ir *InterruptReader) ReadImmediate() (int, error)
ReadImmediate returns immediately with something readily available to read, if any, that happened since PrimeReadImmediate. On unix it means a select with 0 timeout, on windows it means checking the goroutine channel for something already read. Call is split into 2 parts for when not being able to select.
func (*InterruptReader) ReadLine ¶ added in v0.37.0
func (ir *InterruptReader) ReadLine() (string, error)
ReadLine reads until \r or \n (for use when not in rawmode). It returns the line (without the \r, \n, or \r\n).
func (*InterruptReader) ReadNonBlocking ¶ added in v0.36.0
func (ir *InterruptReader) ReadNonBlocking(p []byte) (int, error)
ReadNonBlocking will read what is available already or return 0, nil if nothing is available.
func (*InterruptReader) ReadWithTimeout ¶ added in v0.58.0
func (ir *InterruptReader) ReadWithTimeout(p []byte) (int, error)
ReadWithTimeout reads directly from the underlying reader, bypassing the interrupt handling but still subject to the timeout set on said underlying reader.
func (*InterruptReader) Start ¶ added in v0.8.0
func (ir *InterruptReader) Start(ctx context.Context) (context.Context, context.CancelFunc)
Start or restart (after a cancel/interrupt) the interrupt reader.
func (*InterruptReader) StartDirect ¶ added in v0.59.0
func (ir *InterruptReader) StartDirect()
StartDirect ensures the underlying reader is started (in case of non blocking mode), this is used by [ansipixels.Open].
func (*InterruptReader) Stop ¶ added in v0.9.0
func (ir *InterruptReader) Stop()
type InterruptedError ¶ added in v0.8.1
func NewErrInterrupted ¶ added in v0.8.1
func NewErrInterrupted(reason string) InterruptedError
func NewErrInterruptedWithErr ¶ added in v0.8.1
func NewErrInterruptedWithErr(reason string, err error) InterruptedError
func (InterruptedError) Error ¶ added in v0.8.1
func (e InterruptedError) Error() string
func (InterruptedError) Unwrap ¶ added in v0.8.1
func (e InterruptedError) Unwrap() error
type SyncWriter ¶ added in v0.57.0
type SyncWriter struct {
// Out is the underlying writer to write to.
Out Bufio
// contains filtered or unexported fields
}
SyncWriter is a threadsafe wrapper around a most of the APIs of bufio.Writer.
func (*SyncWriter) Flush ¶ added in v0.57.0
func (w *SyncWriter) Flush() error
func (*SyncWriter) Lock ¶ added in v0.57.0
func (w *SyncWriter) Lock()
Lock: Shares the underlying lock.
func (*SyncWriter) Unlock ¶ added in v0.57.0
func (w *SyncWriter) Unlock()
Unlock: Shares the underlying lock.
func (*SyncWriter) Write ¶ added in v0.57.0
func (w *SyncWriter) Write(buf []byte) (n int, err error)
func (*SyncWriter) WriteByte ¶ added in v0.57.0
func (w *SyncWriter) WriteByte(c byte) error
func (*SyncWriter) WriteRune ¶ added in v0.57.0
func (w *SyncWriter) WriteRune(r rune) (n int, err error)
func (*SyncWriter) WriteString ¶ added in v0.57.0
func (w *SyncWriter) WriteString(s string) (n int, err error)
type SystemTimeoutReader ¶ added in v0.62.0
type SystemTimeoutReader = TimeoutReaderUnixFD
type TermHistory ¶ added in v0.32.0
type TermHistory struct {
// AutoHistory, if true, causes lines to be automatically added to the history (through term's History.Add()).
// If false, call AddToHistory to add lines to the history for instance only adding
// successful commands. Defaults to true. This is controlled through AutoHistory(bool).
AutoHistory bool
// contains filtered or unexported fields
}
TermHistory is a ring buffer of strings.
func NewHistory ¶ added in v0.32.0
func NewHistory(capacity int) *TermHistory
NewHistory creates a new ring buffer of strings with the given capacity.
func (*TermHistory) Add ¶ added in v0.32.0
func (th *TermHistory) Add(a string)
Add is the term.History interface implementation and conditionally adds a string to the ring buffer based on the autoHistory flag.
func (*TermHistory) At ¶ added in v0.32.0
func (th *TermHistory) At(n int) string
At returns the value passed to the nth previous call to Add. If n is zero then the immediately prior value is returned, if one, then the next most recent, and so on. If such an element doesn't exist then ok is false.
func (*TermHistory) Len ¶ added in v0.32.0
func (th *TermHistory) Len() int
Len returns the current number of elements in the ring.
func (*TermHistory) Replace ¶ added in v0.32.0
func (th *TermHistory) Replace(a string) string
Replace theoretically could panic on an empty ring buffer but it's harmless on strings.
func (*TermHistory) UnconditionalAdd ¶ added in v0.32.0
func (th *TermHistory) UnconditionalAdd(a string)
UnconditionalAdd unconditionally add a string to the ring buffer.
type Terminal ¶
type Terminal struct {
// Use this for any output to the screen/console so the required \r are added in raw mode
// the prompt and command edit is refresh as needed when input comes in.
Out io.Writer
// Cancellable context after Open(). Use it to cancel the terminal reading or check for done.
Context context.Context //nolint:containedctx // To avoid Open() returning 4 values.
Cancel context.CancelFunc
// [InterruptReader.Read] can read from the underlying terminal instead of a full line with history and prompt.
// Can be used to read single keystrokes or events still in raw mode, without waiting for a new line.
// [InterruptReader.ReadNonBlocking] reads from the underlying terminal if there is data available.
// Can be used to check for single keystrokes or events still in raw mode,
// while refreshing the output (ie without blocking).
IntrReader *InterruptReader
// Terminal (last updated) width.
Width int
// Terminal (last updated) height.
Height int
// contains filtered or unexported fields
}
func Open ¶
Open opens stdin as a terminal, do `defer terminal.Close()` to restore the terminal to its original state upon exit. fortio.org/log (and thus stdlib "log") will be redirected to the terminal in a manner that preserves the prompt. A default 250ms InterruptReader is used if not set already. New cancellable context is set, use it to cancel the terminal reading or check for done for control-c or signal. You can also call [Setup] to customize the terminal with a custom InterruptReader and/or a custom history.
func (*Terminal) AddToHistory ¶ added in v0.4.0
AddToHistory add commands to the TermHistory.
func (*Terminal) AutoHistory ¶ added in v0.5.0
AutoHistory returns the current auto history setting.
func (*Terminal) Close ¶
Close restores the terminal to its original state. Must be called at exit to avoid leaving the terminal in raw mode. Safe to call multiple times. Will save the history to the history file if one was set using [SetHistoryFile] and the capacity is > 0.
func (*Terminal) IsTerminal ¶
func (*Terminal) LastWasPaste ¶ added in v0.39.0
LastWasPaste returns true if the last ReadLine was a multiline paste.
func (*Terminal) NewHistory ¶ added in v0.4.0
NewHistory creates/resets the history to a new one with the given capacity. Using 0 as capacity will disable history reading and writing but not change the underlying history state from it's DefaultHistoryCapacity.
func (*Terminal) ReadLine ¶
ReadLine reads a line from the terminal using the setup prompt and history and edit capabilities. Returns the line and an error if any. io.EOF is returned when the user presses Control-D. ErrInterrupted is returned when the user presses Control-C or a signal is received. We forward to term.ReadLine when in raw mode, otherwise we read until \n or \r. x/term.ReadLine unfortunately doesn't support \n, so we need to handle that ourselves.
func (*Terminal) ReplaceLatest ¶ added in v0.5.0
ReplaceLatest replaces the current history with the given commands, returns the previous value. Enables to add invalid commands to the history for editing purpose and replace them with the corrected version. Returns the replaced entry.
func (*Terminal) ResetInterrupts ¶ added in v0.8.0
ResetInterrupts resets and restarts if you want to continue after an interrupt.
func (*Terminal) SaveHistory ¶ added in v0.64.1
func (t *Terminal) SaveHistory()
SaveHistory saves the current history to the history file set by [SetHistoryFile]. This is also called automatically by [Close]. This method allows callers to flush history at any time (e.g., before a WASM page unload).
func (*Terminal) SetAutoCompleteCallback ¶
func (t *Terminal) SetAutoCompleteCallback(f AutoCompleteCallback)
SetAutoCompleteCallback sets the callback called for each key press. Can be used to implement auto completion. See example/main.go for an example.
func (*Terminal) SetAutoHistory ¶ added in v0.5.0
SetAutoHistory enables/disables auto history (default is enabled).
func (*Terminal) SetHistoryFile ¶
SetHistoryFile sets up a file to load and save history from/to. File is being read when this is called. If no error is returned, the file will also be automatically updated on Close().
func (*Terminal) Suspend ¶ added in v0.9.0
func (t *Terminal) Suspend()
Suspend temporarily suspends/resumes the terminal back to normal (for example to run a sub process). use defer t.Resume() after calling Suspend() to put the terminal back in raw mode.
func (*Terminal) UpdateSize ¶ added in v0.30.0
UpdateSize refreshes the terminal size to current size (so wrapping works). This is called automatically when the terminal is opened, but can be called again if the terminal size changes (e.g. when resizing the window).
type TimeoutReader ¶ added in v0.8.1
type TimeoutReader struct {
// contains filtered or unexported fields
}
TimeoutReader wraps an io.Reader (typically os.Stdin) to provide read operations with a timeout using a persistent background reader goroutine and internal buffering. It also allows a reset/restart without loosing data to a leftover/pending read if the reset is triggered by say reading a ^C from the input (which will unblock the read).
func NewTimeoutReader ¶ added in v0.17.0
func NewTimeoutReader(stream io.Reader, timeout time.Duration) *TimeoutReader
NewTimeoutReader creates a new TimeoutReader with a persistent background reader. The timeout applies to each Read call waiting for new data. A duration of 0 or less is invalid and will panic.
func (*TimeoutReader) ChangeTimeout ¶ added in v0.17.0
func (tr *TimeoutReader) ChangeTimeout(newTimeout time.Duration)
ChangeTimeout updates the timeout duration for subsequent Read calls when waiting for new data from the background reader. If called currently it will block until the current read completes.
func (*TimeoutReader) Close ¶ added in v0.33.0
func (tr *TimeoutReader) Close() error
Close signals the background reader goroutine to stop and waits for it to exit. It purposely doesn't close the underlying file unless in blocking mode and it implements io.Closer.
func (*TimeoutReader) IsClosed ¶ added in v0.36.0
func (tr *TimeoutReader) IsClosed() bool
IsClosed returns true if Close() has been called (and for the other implementation a new one should be created).
func (*TimeoutReader) PrimeReadImmediate ¶ added in v0.62.0
func (tr *TimeoutReader) PrimeReadImmediate(buf []byte)
PrimeReadImmediate starts a read to be returned later by ReadImmediate.
func (*TimeoutReader) Read ¶ added in v0.17.0
func (tr *TimeoutReader) Read(buf []byte) (int, error)
Read attempts to read into the buffer buf. It first reads from an internal buffer. If the buffer is empty, it waits up to the configured timeout for new data from the background reader. Returns the number of bytes read and an error. If a timeout occurs while waiting for new data, it returns (0, nil), indicating no data read and no error. Note: You should not call Read() with a smaller buffer than the first one when it returns early due to timeout as to avoid extra allocations the inflight buffer will be used and thus could have more data than the new buffer, it will be lost/truncated in that case and the error ErrDataTruncated will be returned.
func (*TimeoutReader) ReadBlocking ¶ added in v0.59.0
func (tr *TimeoutReader) ReadBlocking(buf []byte) (int, error)
ReadBlocking is like Read but makes sure something (or an error) is returned/read.
func (*TimeoutReader) ReadImmediate ¶ added in v0.59.0
func (tr *TimeoutReader) ReadImmediate() (int, error)
ReadImmediate to return immediately what was read since PrimeReadImmediate if any. Data is returned into the buffer provided in PrimeReadImmediate.
func (*TimeoutReader) ReadWithTimeout ¶ added in v0.62.0
func (tr *TimeoutReader) ReadWithTimeout(buf []byte) (int, error)
ReadWithTimeout is an alias to TimeoutReader.Read for the InputReader interface compatibility.
type TimeoutReaderUnixFD ¶ added in v0.62.0
type TimeoutReaderUnixFD struct {
// contains filtered or unexported fields
}
func NewSystemTimeoutReader ¶ added in v0.62.0
func NewSystemTimeoutReader(stream *os.File, timeout time.Duration) *TimeoutReaderUnixFD
func NewTimeoutReaderUnixFD ¶ added in v0.62.0
func NewTimeoutReaderUnixFD(stream *os.File, timeout time.Duration) *TimeoutReaderUnixFD
func (*TimeoutReaderUnixFD) ChangeTimeout ¶ added in v0.62.0
func (tr *TimeoutReaderUnixFD) ChangeTimeout(timeout time.Duration)
ChangeTimeout on unix should be called from same goroutine as any Read* or not concurrently.
func (*TimeoutReaderUnixFD) Close ¶ added in v0.62.0
func (tr *TimeoutReaderUnixFD) Close() (err error)
Close closes the underlying stream if we are in blocking mode. nop otherwise.
func (*TimeoutReaderUnixFD) IsClosed ¶ added in v0.62.0
func (tr *TimeoutReaderUnixFD) IsClosed() bool
IsClosed returns true if Close() has been called (and for the other implementation a new one should be created). Always false on unix/select mode because we can keep using it forever, unlike the goroutine based one. Unless we are in blocking mode and Close() was called.
func (*TimeoutReaderUnixFD) PrimeReadImmediate ¶ added in v0.62.0
func (tr *TimeoutReaderUnixFD) PrimeReadImmediate(buf []byte)
func (*TimeoutReaderUnixFD) Read ¶ added in v0.62.0
func (tr *TimeoutReaderUnixFD) Read(buf []byte) (int, error)
func (*TimeoutReaderUnixFD) ReadBlocking ¶ added in v0.62.0
func (tr *TimeoutReaderUnixFD) ReadBlocking(buf []byte) (int, error)
func (*TimeoutReaderUnixFD) ReadImmediate ¶ added in v0.62.0
func (tr *TimeoutReaderUnixFD) ReadImmediate() (int, error)
func (*TimeoutReaderUnixFD) ReadWithTimeout ¶ added in v0.62.0
func (tr *TimeoutReaderUnixFD) ReadWithTimeout(buf []byte) (int, error)
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package ansipixels provides terminal drawing and key reading abilities.
|
Package ansipixels provides terminal drawing and key reading abilities. |
|
linetest
command
|
|
|
tcolor
Package tcolor provides ANSI color codes and utilities for terminal colors.
|
Package tcolor provides ANSI color codes and utilities for terminal colors. |
|
* A more interesting/real example is https://github.com/grol-io/grol * but this demonstrates most of the features of the terminal package.
|
* A more interesting/real example is https://github.com/grol-io/grol * but this demonstrates most of the features of the terminal package. |
|
fps
module
|
|
|
nocolor is a simple utility to filter out all Ansi (color, cursor movement, etc...) sequences from stdin to stdout.
|
nocolor is a simple utility to filter out all Ansi (color, cursor movement, etc...) sequences from stdin to stdout. |





