history

package
v0.45.3 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2025 License: MIT Imports: 6 Imported by: 0

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.42.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) 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.42.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