program

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package program wraps the initial interaction with the end user, before (if ever) the control is passed to the tea.Program.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Program)

Option is a function that can be passed to WithOptions.

func WithBuildInfo

func WithBuildInfo(version, commit, date string) Option

WithBuildInfo sets the version information of this program.

func WithFlagSet

func WithFlagSet(fs *flag.FlagSet, args []string) Option

WithFlagSet is an optional way to set the flag set for the program. Useful in tests.

func WithGoModInfo added in v0.4.1

func WithGoModInfo() Option

WithGoModInfo reads build info and sets its fields, if its available.

func WithInput added in v0.3.0

func WithInput(file fs.File) Option

WithInput sets the stdin for the program. This should be used for testing the features that read from stdin.

func WithLogFile

func WithLogFile(path string) Option

WithLogFile sets the path to the log file.

func WithOutput

func WithOutput(w io.Writer) Option

WithOutput sets the stdout writer for the program. This should be used for testing some of the basic outputs (non-interactive).

type Program

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

Program holds the program configuration.

func New

func New(opts ...Option) *Program

New return a new Program instance. Optional configuration is available using `With...` functions.

func (*Program) Run

func (p *Program) Run() error

Run parses the command line arguments and runs the program.

Jump to

Keyboard shortcuts

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