cli

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithCore added in v0.5.0

func WithCore(core *core.Core) func(*CLI)

Optional function to set the core of the CLI when creating a new instance.

func WithIn added in v0.5.0

func WithIn(in io.Reader) func(*CLI)

Optional function to set the input of the CLI when creating a new instance.

func WithOut added in v0.5.0

func WithOut(out io.Writer) func(*CLI)

Optional function to set the output of the CLI when creating a new instance.

Types

type CLI added in v0.5.0

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

CLI struct that that determines the input and output of the CLI.

It uses a message channel to communicate with the core.

func New added in v0.5.0

func New(options ...func(*CLI)) *CLI

Create a new CLI instance with the given options.

func (*CLI) ClearTerminal added in v0.5.0

func (c *CLI) ClearTerminal()

Clear the terminal screen by sending the escape codes to the output.

func (*CLI) Confirm added in v0.5.0

func (c *CLI) Confirm(prompt string) bool

CLI handling of Confirm component.

func (*CLI) ErrorPrint added in v0.5.0

func (c *CLI) ErrorPrint(a ...any)

Print the given arguments as error text.

func (*CLI) ErrorPrintf added in v0.5.0

func (c *CLI) ErrorPrintf(format string, a ...any)

Print the given arguments as formatted error text.

func (*CLI) Handle added in v0.5.0

func (c *CLI) Handle()

Function to be called after the CLI has been initialized.

It will handle the arguments passed to the CLI and execute the appropriate function based on the arguments.

func (*CLI) InfoPrint added in v0.5.0

func (c *CLI) InfoPrint(a ...any)

Print the given arguments as info text.

func (*CLI) InfoPrintf added in v0.5.0

func (c *CLI) InfoPrintf(format string, a ...any)

Print the given arguments as formatted info text.

func (*CLI) Input added in v0.5.0

func (c *CLI) Input(prompt string, defaultValue string) string

CLI handling of Input component.

func (*CLI) Loading added in v0.5.0

func (c *CLI) Loading(loadingText string, f func() common.Msg) common.Msg

CLI handling of Loading component.

func (*CLI) MsgPrint added in v0.5.0

func (c *CLI) MsgPrint(msg common.Msg)

Print the given message based on its type.

func (*CLI) Question added in v0.5.0

func (c *CLI) Question(prompt string, options []string, defaultSelected []bool) ([]string, error, bool)

CLI handling of Question component.

func (*CLI) Selection added in v0.5.0

func (c *CLI) Selection(prompt string, options []string) (string, error, bool)

CLI handling of Selection component.

func (*CLI) SuccessPrint added in v0.5.0

func (c *CLI) SuccessPrint(a ...any)

Print the given arguments as success text.

func (*CLI) SuccessPrintf added in v0.5.0

func (c *CLI) SuccessPrintf(format string, a ...any)

Print the given arguments as formatted success text.

func (*CLI) WarningPrint added in v0.5.0

func (c *CLI) WarningPrint(a ...any)

Print the given arguments as warning text.

func (*CLI) WarningPrintf added in v0.5.0

func (c *CLI) WarningPrintf(format string, a ...any)

Print the given arguments as formatted warning text.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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