Documentation
¶
Index ¶
- func EnsureLogDir(logDir string) error
- type Entry
- type EntryType
- type GitHelper
- type Logger
- func (l *Logger) Dump(w io.Writer) error
- func (l *Logger) GetLastEntry(refArg ...string) (*Entry, error)
- func (l *Logger) GetLastRegularEntry(refArg ...string) (*Entry, error)
- func (l *Logger) GetLogPath() string
- func (l *Logger) LogCommand(strGitCommand string) error
- func (l *Logger) ToggleEntry(entryIdentifier string) error
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 last entry for the given ref (or current ref if not specified) regarding of the entry type (undoed or regular).
func (*Logger) GetLastRegularEntry ¶ added in v0.0.2
GetLastRegularEntry returns last regular entry (ignoring undoed ones) for the given ref (or current ref if not specified).
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.