display

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package display prints and receives input from the console.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Action

func Action(t TLogger, action string)

Action displays the specified action message. If t is not nil, the message is associated with the current test case.

func Banner(t TLogger, lines ...string)

Banner displays a banner message with the specified lines. If t is not nil, the message is associated with the current test case.

func Menu(msg string, options ...string) int

Menu displays a menu with the specified message and list of options and returns the 1-indexed option number that the user selected.

func ReadLine

func ReadLine() string

ReadLine reads a line of user input. Exits fatally if the reader has not been started.

func ReaderStarted

func ReaderStarted() bool

ReaderStarted returns whether or not the reader has started.

func StartReader

func StartReader() error

StartReader starts a stdin reader.

func StopReader

func StopReader() error

StopReader stops the reader. Noop if it hasn't started.

Types

type TLogger added in v0.1.7

type TLogger interface {
	Helper()
	Log(...any)
}

TLogger is the subset of testing.T needed for logging.

var (
	// MainT is used for logging in TestMain.
	MainT TLogger = &mainLogger{}
)

Jump to

Keyboard shortcuts

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