prompt

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2020 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package prompt provides an implementation of the cli.Prompt interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// The function that computes the prompt.
	Compute func() ui.Text
	// Function to transform stale prompts.
	StaleTransform func(ui.Text) ui.Text
	// Threshold for a prompt to be considered as stale.
	StaleThreshold func() time.Duration
	// How eager the prompt should be updated. When >= 5, updated when directory
	// is changed. When >= 10, always update. Default is 5.
	Eagerness func() int
}

Config keeps configurations for the prompt.

type Prompt

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

Prompt implements a prompt that is executed asynchronously.

func New

func New(cfg Config) *Prompt

New makes a new prompt.

func (*Prompt) Get

func (p *Prompt) Get() ui.Text

Get returns the current content of the prompt.

func (*Prompt) LateUpdates

func (p *Prompt) LateUpdates() <-chan struct{}

LateUpdates returns a channel on which late updates are made available.

func (*Prompt) Trigger

func (p *Prompt) Trigger(force bool)

Trigger triggers an update to the prompt.

Jump to

Keyboard shortcuts

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