(fileName string)
| 305 | } |
| 306 | |
| 307 | func 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 | |
| 337 | func GetLocalWshBinaryPath(version string, goos string, goarch string) (string, error) { |
| 338 | ext := "" |
no test coverage detected