Documentation
¶
Index ¶
- func WithCore(core *core.Core) func(*CLI)
- func WithIn(in io.Reader) func(*CLI)
- func WithOut(out io.Writer) func(*CLI)
- type CLI
- func (c *CLI) ClearTerminal()
- func (c *CLI) Confirm(prompt string) bool
- func (c *CLI) ErrorPrint(a ...any)
- func (c *CLI) ErrorPrintf(format string, a ...any)
- func (c *CLI) Handle()
- func (c *CLI) InfoPrint(a ...any)
- func (c *CLI) InfoPrintf(format string, a ...any)
- func (c *CLI) Input(prompt string, defaultValue string) string
- func (c *CLI) Loading(loadingText string, f func() common.Msg) common.Msg
- func (c *CLI) MsgPrint(msg common.Msg)
- func (c *CLI) Question(prompt string, options []string, defaultSelected []bool) ([]string, error, bool)
- func (c *CLI) Selection(prompt string, options []string) (string, error, bool)
- func (c *CLI) SuccessPrint(a ...any)
- func (c *CLI) SuccessPrintf(format string, a ...any)
- func (c *CLI) WarningPrint(a ...any)
- func (c *CLI) WarningPrintf(format string, a ...any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithCore ¶ added in v0.5.0
Optional function to set the core 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 (*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) ErrorPrint ¶ added in v0.5.0
Print the given arguments as error text.
func (*CLI) ErrorPrintf ¶ added in v0.5.0
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) InfoPrintf ¶ added in v0.5.0
Print the given arguments as formatted info text.
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) SuccessPrint ¶ added in v0.5.0
Print the given arguments as success text.
func (*CLI) SuccessPrintf ¶ added in v0.5.0
Print the given arguments as formatted success text.
func (*CLI) WarningPrint ¶ added in v0.5.0
Print the given arguments as warning text.
func (*CLI) WarningPrintf ¶ added in v0.5.0
Print the given arguments as formatted warning text.