()
| 208 | } |
| 209 | |
| 210 | func (cli *ChatCLI) worktreeStatus() { |
| 211 | if !isGitRepo() { |
| 212 | fmt.Println(colorize(" "+i18n.T("wt.cmd.not_in_git_repo"), ColorYellow)) |
| 213 | return |
| 214 | } |
| 215 | |
| 216 | cwd, _ := os.Getwd() |
| 217 | branch := getCurrentBranch() |
| 218 | repoRoot := getGitRepoRoot() |
| 219 | |
| 220 | fmt.Println() |
| 221 | fmt.Println(colorize(" "+i18n.T("wt.cmd.title_status"), ColorCyan)) |
| 222 | fmt.Println(colorize(" "+strings.Repeat("─", 50), ColorGray)) |
| 223 | fmt.Printf(" %s %s\n", i18n.T("wt.cmd.label_cwd"), cwd) |
| 224 | fmt.Printf(" %s %s\n", i18n.T("wt.cmd.label_branch"), colorize(branch, ColorGreen)) |
| 225 | fmt.Printf(" %s %s\n", i18n.T("wt.cmd.label_repo"), repoRoot) |
| 226 | |
| 227 | isWorktree := cwd != repoRoot |
| 228 | if isWorktree { |
| 229 | fmt.Printf(" %s %s\n", i18n.T("wt.cmd.label_type"), colorize(i18n.T("wt.cmd.type_linked"), ColorCyan)) |
| 230 | } else { |
| 231 | fmt.Printf(" %s %s\n", i18n.T("wt.cmd.label_type"), colorize(i18n.T("wt.cmd.type_main"), ColorGray)) |
| 232 | } |
| 233 | |
| 234 | // Count worktrees |
| 235 | cmd := exec.Command("git", "worktree", "list") |
| 236 | if out, err := cmd.Output(); err == nil { |
| 237 | count := len(strings.Split(strings.TrimSpace(string(out)), "\n")) |
| 238 | fmt.Printf(" %s %s\n", i18n.T("wt.cmd.label_total"), i18n.T("wt.cmd.total_count", count)) |
| 239 | } |
| 240 | fmt.Println() |
| 241 | } |
| 242 | |
| 243 | // --- git helpers --- |
| 244 |
no test coverage detected