MCPcopy Create free account
hub / github.com/diillson/chatcli / worktreeStatus

Method worktreeStatus

cli/worktree.go:210–241  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

208}
209
210func (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

Callers 1

handleWorktreeCommandMethod · 0.95

Calls 6

TFunction · 0.92
isGitRepoFunction · 0.85
colorizeFunction · 0.85
getCurrentBranchFunction · 0.85
getGitRepoRootFunction · 0.85
OutputMethod · 0.65

Tested by

no test coverage detected