core

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: GPL-3.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnalyticsFile

func AnalyticsFile() string

func CleanLogFiles added in v0.35.0

func CleanLogFiles() error

func DataDir

func DataDir() string

func HistoryFile

func HistoryFile() string

func HomeDir

func HomeDir() string

func LatestVersionFile

func LatestVersionFile() string

func LogDir added in v0.35.0

func LogDir() string

func LogFile

func LogFile() string

func NewAutocdExecHandler added in v0.30.0

func NewAutocdExecHandler() func(next interp.ExecHandlerFunc) interp.ExecHandlerFunc

NewAutocdExecHandler creates an ExecHandler that implements autocd. It checks if non-command inputs are directories and executes cd instead. This allows builtins and commands to take precedence naturally without needing to maintain a hardcoded list of builtin names.

func RotateLogFiles added in v0.35.0

func RotateLogFiles() error

RotateLogFiles automatically removes old log files to prevent unbounded growth. Keeps the most recent 10 log files (based on modification time). This is called automatically when creating a new log sink.

func RunInteractiveShell

func RunInteractiveShell(
	ctx context.Context,
	runner *interp.Runner,
	historyManager *history.HistoryManager,
	analyticsManager *analytics.AnalyticsManager,
	completionManager *completion.CompletionManager,
	coachManager *coach.CoachManager,
	logger *zap.Logger,
	stderrCapturer *StderrCapturer,
) error

func SetAutocdRunner added in v0.30.0

func SetAutocdRunner(runner *interp.Runner)

SetAutocdRunner sets the runner for the autocd handler

func TryAutocd added in v0.30.0

func TryAutocd(input string, runner *interp.Runner) (string, bool)

TryAutocd checks if the input should trigger autocd and returns the modified command Returns the original input if autocd should not trigger, or "cd <path>" if it should Also returns a boolean indicating whether autocd was triggered

Types

type DefaultUserPrompter

type DefaultUserPrompter struct{}

func (DefaultUserPrompter) Prompt

func (p DefaultUserPrompter) Prompt(
	prompt string,
	historyValues []string,
	explanation string,
	predictor gline.Predictor,
	explainer gline.Explainer,
	analytics gline.PredictionAnalytics,
	logger *zap.Logger,
	options gline.Options,
) (string, string, error)

type Paths

type Paths struct {
	HomeDir           string
	DataDir           string
	LogFile           string
	HistoryFile       string
	AnalyticsFile     string
	LatestVersionFile string
}

type ShellState

type ShellState struct {
	LastCommand  string
	LastExitCode int
	LastStderr   string
	FixHintShown bool // Track if the #? fix hint has been shown this session
}

ShellState holds the state of the shell execution

type StderrCapturer

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

StderrCapturer wraps an io.Writer and captures the output into a buffer

func NewStderrCapturer

func NewStderrCapturer(original io.Writer) *StderrCapturer

func (*StderrCapturer) StartCapture

func (c *StderrCapturer) StartCapture()

func (*StderrCapturer) StopCapture

func (c *StderrCapturer) StopCapture() string

func (*StderrCapturer) Write

func (c *StderrCapturer) Write(p []byte) (n int, err error)

type UserPrompter

type UserPrompter interface {
	Prompt(
		prompt string,
		historyValues []string,
		explanation string,
		predictor gline.Predictor,
		explainer gline.Explainer,
		analytics gline.PredictionAnalytics,
		logger *zap.Logger,
		options gline.Options,
	) (string, string, error)
}

Jump to

Keyboard shortcuts

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