Documentation
¶
Overview ¶
Package histree provides core functionality for shell history management
Index ¶
Constants ¶
View Source
const (
Version = "v0.3.5"
)
Version information
Variables ¶
This section is empty.
Functions ¶
func WriteEntries ¶
func WriteEntries(entries []HistoryEntry, w io.Writer, format OutputFormat) error
WriteEntries writes history entries to the provided writer using the specified format
Types ¶
type DB ¶
DB represents a histree database connection
func (*DB) AddEntry ¶
func (db *DB) AddEntry(entry *HistoryEntry) error
AddEntry adds a new command history entry to the database
func (*DB) GetEntries ¶
func (db *DB) GetEntries(limit int, currentDir string) ([]HistoryEntry, error)
GetEntries retrieves command history entries from the database
type HistoryEntry ¶
type HistoryEntry struct {
Command string `json:"command"`
Directory string `json:"directory"`
Timestamp time.Time `json:"timestamp"`
ExitCode int `json:"exit_code"`
Hostname string `json:"hostname,omitempty"`
ProcessID int `json:"process_id,omitempty"` // The process ID of the shell that executed the command
}
HistoryEntry represents a shell command history entry
type OutputFormat ¶
type OutputFormat string
OutputFormat defines how history entries are formatted when displayed
const ( // FormatJSON outputs entries as JSON objects FormatJSON OutputFormat = "json" // FormatSimple outputs only the command FormatSimple OutputFormat = "simple" // FormatVerbose outputs entries with timestamp, directory and exit code FormatVerbose OutputFormat = "verbose" )
Click to show internal directories.
Click to hide internal directories.