Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureLogDir ¶
EnsureLogDir ensures the git-undo log directory exists.
Types ¶
type Entry ¶
type Entry struct { // Timestamp is parsed timestamp of the entry. Timestamp time.Time // Ref is reference (branch/tag/commit) where the command was executed. Ref string // Command is just the command part. Command string // Undoed is true if the entry is undoed. Undoed bool }
Entry represents a logged git command with its full identifier.
func (*Entry) GetIdentifier ¶
GetIdentifier returns full command without sign of undoed state (# prefix).
func (*Entry) MarshalText ¶
func (*Entry) String ¶
String returns a human-readable representation of the entry. This representation goes into the log file as well.
func (*Entry) UnmarshalText ¶
type EntryType ¶
type EntryType int
EntryType specifies whether to look for regular or undoed entries.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger manages git command logging operations.
func (*Logger) Dump ¶
Dump reads the log file content and writes it directly to the provided writer.
func (*Logger) GetLastEntry ¶
GetLastEntry returns either the last regular entry or the last undoed entry based on the entryType. If a reference is provided in refArg, only entries from that specific reference are considered. If no reference is provided, uses the current reference (branch/tag/commit). Use "any" as refArg to match any reference.
func (*Logger) GetLogPath ¶
GetLogPath returns the path to the log file.
func (*Logger) LogCommand ¶
LogCommand logs a git command with timestamp.
func (*Logger) ToggleEntry ¶
ToggleEntry toggles the undo state of an entry by adding or removing the "#" prefix. The entryIdentifier should be in the format "TIMESTAMP|REF|COMMAND" (without the # prefix). Returns true if the entry was marked as undoed, false if it was unmarked.