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

Method worktreeList

cli/worktree.go:112–143  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

110}
111
112func (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
145func (cli *ChatCLI) worktreeRemove(target string) {
146 if !isGitRepo() {

Callers 1

handleWorktreeCommandMethod · 0.95

Calls 4

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

Tested by

no test coverage detected