cli

package
v0.0.0-...-87e4b86 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

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

Executor handles execution of CLI commands and interaction with prompts.

func NewExecutor

func NewExecutor(cfg *config.Config) *Executor

NewExecutor creates a new command executor.

func (*Executor) Execute

func (e *Executor) Execute(args []string) error

Execute runs the command in interactive mode, handling the CLI directly.

func (*Executor) ExecuteWithOutput

func (e *Executor) ExecuteWithOutput(args []string, promptContent string) (string, error)

ExecuteWithOutput runs the CLI tool and returns output, handling prompts with expect. The function first processes output until both the prompt content and a confirmation (enter) have been sent. It then enters a monitoring phase that tracks the pattern "esc to interrupt" with ANSI escape codes, and exits when the pattern disappears for a specified time.

Jump to

Keyboard shortcuts

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