out

package
v2.0.11 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PagerInstructions

func PagerInstructions(keys []KeyBinding) func(width int) string

PagerInstructions returns a nano-style instructions bar for the pager.

Types

type FieldOption

type FieldOption func(*FormField)

FieldOption can be used to apply common changes to a set of fields.

var VerbosePrompts FieldOption = func(field *FormField) {
	field.verbose = true
}

VerbosePrompts is an option to enable verbose field prompts.

func GlobalInstructions

func GlobalInstructions(ins ...interface{}) FieldOption

GlobalInstructions appends the supplied instructions to every field.

type FormField

type FormField struct {
	Prompt          string
	PromptVerbose   string
	Placeholder     string
	LoadingMessage  string
	Instructions    []interface{}
	InputOnSameLine bool
	Choices         []string
	Completions     form.Completions
	// contains filtered or unexported fields
}

FormField is used to create new form fields with more consistency.

func (FormField) NewChoiceField

func (f FormField) NewChoiceField(opts ...FieldOption) form.ChoiceField

NewChoiceField creates a new single choice form field from the current state of this field spec.

func (FormField) NewExitField

func (f FormField) NewExitField(opts ...FieldOption) form.ExitField

NewExitField creates a field that triggers an exit as soon as it is focused.

func (FormField) NewMultiChoiceField

func (f FormField) NewMultiChoiceField(opts ...FieldOption) form.MultiChoiceField

NewMultiChoiceField creates a new multiple choice form field from the current state of this field spec.

func (FormField) NewTextField

func (f FormField) NewTextField(opts ...FieldOption) form.TextField

NewTextField creates a new text form field from the current state of this field spec.

type KeyBinding

type KeyBinding struct {
	// The key bound to the action.
	Key tea.Key
	// The description of the action.
	Desc string
}

KeyBinding represents a description of what a key should do.

type Style

type Style int
const (
	Happy Style = iota
	Sad
	ReallySad
	NotGood
	Version
	Authorized
	Unauthorized
	Initializing
	Ready
	Starting
	Running
	Watching
	Completed
	Failure
	Instructions
	YesNo
	Preview
)

type View

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

View is used to render a view line by line.

func (*View) Model

func (v *View) Model(m interface{ View() string })

Model includes an entire sub-model in this view.

func (*View) Newline

func (v *View) Newline()

Newline adds an empty line to this view.

func (*View) Step

func (v *View) Step(style Style, format string, args ...interface{})

Step adds a stylized line to the view.

func (*View) String

func (v *View) String() string

String returns the rendered view.

func (*View) Write

func (v *View) Write(p []byte) (int, error)

Write allows this view to be used as a writer.

Jump to

Keyboard shortcuts

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