()
| 110 | } |
| 111 | |
| 112 | func (cli *ChatCLI) worktreeList() { |
| 113 | if !isGitRepo() { |
| 114 | fmt.Println(colorize(" "+i18n.T("wt.cmd.not_in_git_repo"), ColorYellow)) |
| 115 | return |
| 116 | } |
| 117 | |
| 118 | cmd := exec.Command("git", "worktree", "list") |
| 119 | output, err := cmd.Output() |
| 120 | if err != nil { |
| 121 | fmt.Println(colorize(" "+i18n.T("wt.cmd.err_generic", err), ColorRed)) |
| 122 | return |
| 123 | } |
| 124 | |
| 125 | fmt.Println() |
| 126 | fmt.Println(colorize(" "+i18n.T("wt.cmd.title_list"), ColorCyan)) |
| 127 | fmt.Println(colorize(" "+strings.Repeat("─", 50), ColorGray)) |
| 128 | |
| 129 | cwd, _ := os.Getwd() |
| 130 | lines := strings.Split(strings.TrimSpace(string(output)), "\n") |
| 131 | for _, line := range lines { |
| 132 | if strings.TrimSpace(line) == "" { |
| 133 | continue |
| 134 | } |
| 135 | indicator := " " |
| 136 | parts := strings.Fields(line) |
| 137 | if len(parts) > 0 && parts[0] == cwd { |
| 138 | indicator = colorize("→ ", ColorGreen) |
| 139 | } |
| 140 | fmt.Printf(" %s%s\n", indicator, line) |
| 141 | } |
| 142 | fmt.Println() |
| 143 | } |
| 144 | |
| 145 | func (cli *ChatCLI) worktreeRemove(target string) { |
| 146 | if !isGitRepo() { |
no test coverage detected