MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / IsExtendedZshHistoryFile

Function IsExtendedZshHistoryFile

pkg/util/shellutil/shellutil.go:307–335  ·  view source on GitHub ↗
(fileName string)

Source from the content-addressed store, hash-verified

305}
306
307func IsExtendedZshHistoryFile(fileName string) (bool, error) {
308 file, err := os.Open(fileName)
309 if err != nil {
310 if os.IsNotExist(err) {
311 return false, nil
312 }
313 return false, err
314 }
315 defer file.Close()
316
317 buf := make([]byte, 1024)
318 n, err := file.Read(buf)
319 if err != nil {
320 return false, err
321 }
322
323 content := string(buf[:n])
324 lines := strings.Split(content, "\n")
325
326 for _, line := range lines {
327 line = strings.TrimSpace(line)
328 if line == "" {
329 continue
330 }
331 return ZshExtendedHistoryPattern.MatchString(line), nil
332 }
333
334 return false, nil
335}
336
337func GetLocalWshBinaryPath(version string, goos string, goarch string) (string, error) {
338 ext := ""

Callers 1

FixupWaveZshHistoryFunction · 0.85

Calls 3

OpenMethod · 0.80
CloseMethod · 0.65
ReadMethod · 0.45

Tested by

no test coverage detected