MCPcopy Create free account
hub / github.com/diillson/chatcli / processZshHistory

Function processZshHistory

utils/shell_utils.go:105–122  ·  view source on GitHub ↗

processZshHistory processa o histórico do Zsh para remover metadados e retornar apenas os comandos.

(data string)

Source from the content-addressed store, hash-verified

103
104// processZshHistory processa o histórico do Zsh para remover metadados e retornar apenas os comandos.
105func processZshHistory(data string) string {
106 lines := strings.Split(data, "\n")
107 var commands []string
108
109 for _, line := range lines {
110 if strings.HasPrefix(line, ":") {
111 idx := strings.Index(line, ";")
112 if idx != -1 && idx+1 < len(line) {
113 command := line[idx+1:]
114 commands = append(commands, command)
115 }
116 } else {
117 commands = append(commands, line)
118 }
119 }
120
121 return strings.Join(commands, "\n")
122}

Callers 1

GetShellHistoryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected