(cwd string)
| 596 | true, |
| 597 | } |
| 598 | } |
| 599 | |
| 600 | func firstRunes(text string, limit int) string { |
| 601 | if limit <= 0 { |
| 602 | return "" |
| 603 | } |
| 604 | runes := []rune(text) |
| 605 | if len(runes) <= limit { |
| 606 | return text |
| 607 | } |
| 608 | return string(runes[:limit]) |
| 609 | } |
| 610 | |
| 611 | func pythonSplitLines(text string) []string { |
| 612 | if text == "" { |
| 613 | return []string{} |
| 614 | } |
| 615 | normalized := strings.ReplaceAll(text, "\r\n", "\n") |
| 616 | normalized = strings.ReplaceAll(normalized, "\r", "\n") |
| 617 | lines := strings.Split(normalized, "\n") |
| 618 | if len(lines) > 0 && lines[len(lines)-1] == "" { |
| 619 | lines = lines[:len(lines)-1] |
| 620 | } |
| 621 | return lines |
| 622 | } |
| 623 | |
| 624 | func BuildEnvSection(cwd string) PromptSection { |
| 625 | env := GetEnvInfo() |
| 626 | displayCwd := cwd |
| 627 | if hook := currentPromptHooks().EnvInfo; hook != nil && env["cwd"] != "" { |
no test coverage detected