history

package
v0.76.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HistoryManager

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

HistoryManager manages both in-memory and shell history

func NewHistoryManager

func NewHistoryManager(maxInMemory int) (*HistoryManager, error)

NewHistoryManager creates a new history manager

func NewHistoryManagerWithDir added in v0.41.0

func NewHistoryManagerWithDir(maxInMemory int, configDir string) (*HistoryManager, error)

NewHistoryManagerWithDir creates a new history manager with a custom config directory

func NewMemoryOnlyHistoryManager

func NewMemoryOnlyHistoryManager(maxInMemory int) *HistoryManager

NewMemoryOnlyHistoryManager creates a history manager that only uses in-memory storage

func (*HistoryManager) AddToHistory

func (hm *HistoryManager) AddToHistory(command string) error

AddToHistory adds a command to both in-memory and shell history

func (*HistoryManager) GetHistoryCount

func (hm *HistoryManager) GetHistoryCount() int

GetHistoryCount returns the total number of commands in history

func (*HistoryManager) GetShellHistoryFile

func (hm *HistoryManager) GetShellHistoryFile() string

GetShellHistoryFile returns the shell history file path

func (*HistoryManager) IsNavigating added in v0.76.1

func (hm *HistoryManager) IsNavigating() bool

IsNavigating returns true if currently navigating through history

func (*HistoryManager) NavigateDown

func (hm *HistoryManager) NavigateDown(currentText string) string

NavigateDown moves down in history (to newer commands)

func (*HistoryManager) NavigateUp

func (hm *HistoryManager) NavigateUp(currentText string) string

NavigateUp moves up in history (to older commands)

func (*HistoryManager) ResetNavigation

func (hm *HistoryManager) ResetNavigation()

ResetNavigation resets history navigation state

type MemoryOnlyShellHistory

type MemoryOnlyShellHistory struct{}

MemoryOnlyShellHistory provides a no-op shell history provider for testing

func (*MemoryOnlyShellHistory) GetHistoryFile

func (m *MemoryOnlyShellHistory) GetHistoryFile() string

func (*MemoryOnlyShellHistory) LoadHistory

func (m *MemoryOnlyShellHistory) LoadHistory() ([]string, error)

func (*MemoryOnlyShellHistory) SaveToHistory

func (m *MemoryOnlyShellHistory) SaveToHistory(command string) error

type ShellHistory

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

ShellHistory implements project-specific history

func NewShellHistory

func NewShellHistory() (*ShellHistory, error)

NewShellHistory creates a new shell history provider

func NewShellHistoryWithDir added in v0.41.0

func NewShellHistoryWithDir(configDir string) (*ShellHistory, error)

NewShellHistoryWithDir creates a new shell history provider with a custom directory

func (*ShellHistory) GetHistoryFile

func (sh *ShellHistory) GetHistoryFile() string

GetHistoryFile returns the current history file path

func (*ShellHistory) LoadHistory

func (sh *ShellHistory) LoadHistory() ([]string, error)

LoadHistory loads commands from history file

func (*ShellHistory) SaveToHistory

func (sh *ShellHistory) SaveToHistory(command string) error

SaveToHistory appends a command to the history file

type ShellHistoryProvider

type ShellHistoryProvider interface {
	LoadHistory() ([]string, error)
	SaveToHistory(command string) error
	GetHistoryFile() string
}

ShellHistoryProvider interface defines methods for shell history operations

Jump to

Keyboard shortcuts

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