elvish: github.com/elves/elvish/pkg/cli/prompt Index | Files

package prompt

import "github.com/elves/elvish/pkg/cli/prompt"

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

Index

Package Files

prompt.go

type Config Uses

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 Uses

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

Prompt implements a prompt that is executed asynchronously.

func New Uses

func New(cfg Config) *Prompt

New makes a new prompt.

func (*Prompt) Get Uses

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

Get returns the current content of the prompt.

func (*Prompt) LateUpdates Uses

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

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

func (*Prompt) Trigger Uses

func (p *Prompt) Trigger(force bool)

Trigger triggers an update to the prompt.

Package prompt imports 4 packages (graph) and is imported by 1 packages. Updated 2020-01-01. Refresh now. Tools for package owners.