ask

package
v0.0.0-...-dbfa471 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BreakSentinel = "__whdb_break"
View Source
var ErrBreak = errors.New("psuedo-break error")

ErrBreak represents a 'break' in environments that do not have a real break, like our WASM intepreter. Basically what happens in all cases would be:

  • The Ask implementation panics with ErrBreak
  • The handler for this invocation recovers from panics, and checks if recover() == ErrBreak.
  • If it is, we should indicate to the caller (the web terminal) that the client used a break.
  • The client should interpret this how it needs, which is going to emulate a normal terminal.

Functions

func HiddenPrompt

func HiddenPrompt(prefix string) string

Types

type Ask

type Ask interface {
	// Ask prints the given prompt and asks for input.
	// It returns the input, or an error.
	Ask(prompt string) (string, error)
	// HiddenAsk is like Ask, but the input is hidden if possible.
	HiddenAsk(prompt string) (string, error)
	// Feedback prints the given feedback.
	// This is usually used to print any output after the result of an Ask.
	Feedback(line string)
}

Ask encapsulates the prompting and feedback of asking for input.

func New

func New() Ask

Jump to

Keyboard shortcuts

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