@@ -6,11 +6,11 @@ import (
66 "strings"
77 "time"
88
9- "github.com/spf13/cobra"
109 "github.com/albertywu/gitpool/config"
1110 "github.com/albertywu/gitpool/internal"
1211 "github.com/albertywu/gitpool/ipc"
1312 "github.com/albertywu/gitpool/models"
13+ "github.com/spf13/cobra"
1414)
1515
1616// ANSI color codes
@@ -69,17 +69,17 @@ func NewListCmd() *cobra.Command {
6969 maxWidth := len ("MAX" )
7070 branchWidth := len ("BRANCH" )
7171 lastSyncWidth := len ("LAST_SYNC" )
72-
72+
7373 // Find maximum widths based on actual data
7474 for _ , detail := range details {
7575 wt := detail .Worktree
7676 repo := detail .Repository
77-
77+
7878 // ID column
7979 if len (wt .Name ) > idWidth {
8080 idWidth = len (wt .Name )
8181 }
82-
82+
8383 // Workspace column
8484 workspaceLen := 0
8585 if wt .Status == models .WorktreeStatusInUse && wt .Branch != nil && * wt .Branch != "" {
@@ -90,12 +90,12 @@ func NewListCmd() *cobra.Command {
9090 if workspaceLen > workspaceWidth {
9191 workspaceWidth = workspaceLen
9292 }
93-
93+
9494 // Repo column
9595 if len (repo .Name ) > repoWidth {
9696 repoWidth = len (repo .Name )
9797 }
98-
98+
9999 // Status column
100100 statusLen := 0
101101 switch wt .Status {
@@ -109,18 +109,18 @@ func NewListCmd() *cobra.Command {
109109 if statusLen > statusWidth {
110110 statusWidth = statusLen
111111 }
112-
112+
113113 // MAX column
114114 maxStr := fmt .Sprintf ("%d" , repo .MaxWorktrees )
115115 if len (maxStr ) > maxWidth {
116116 maxWidth = len (maxStr )
117117 }
118-
118+
119119 // Branch column
120120 if len (repo .DefaultBranch ) > branchWidth {
121121 branchWidth = len (repo .DefaultBranch )
122122 }
123-
123+
124124 // Last sync column
125125 var lastFetchLen int
126126 if repo .LastFetchTime != nil {
@@ -165,7 +165,7 @@ func NewListCmd() *cobra.Command {
165165 }
166166
167167 // Print table header
168- fmt .Printf ("%s%s%-*s %-*s %-*s %-*s %-*s %-*s %-*s%s\n " ,
168+ fmt .Printf ("%s%s%-*s %-*s %-*s %-*s %-*s %-*s %-*s%s\n " ,
169169 colorBold , colorGray ,
170170 idWidth , "ID" ,
171171 workspaceWidth , "WORKSPACE" ,
@@ -175,7 +175,7 @@ func NewListCmd() *cobra.Command {
175175 branchWidth , "BRANCH" ,
176176 lastSyncWidth , "LAST_SYNC" ,
177177 colorReset )
178-
178+
179179 // Print separator
180180 fmt .Printf ("%s%s %s %s %s %s %s %s%s\n " ,
181181 colorGray ,
@@ -192,7 +192,7 @@ func NewListCmd() *cobra.Command {
192192 for _ , detail := range details {
193193 wt := detail .Worktree
194194 repo := detail .Repository
195-
195+
196196 // Choose color based on status
197197 statusColor := colorGreen
198198 statusText := "IDLE"
@@ -220,11 +220,11 @@ func NewListCmd() *cobra.Command {
220220 } else {
221221 lastFetchDisplay = "never"
222222 }
223-
223+
224224 // Format workspace display based on status
225225 var workspaceDisplay string
226226 var workspaceColor string
227-
227+
228228 if wt .Status == models .WorktreeStatusInUse && wt .Branch != nil && * wt .Branch != "" {
229229 // Show branch name in yellow for claimed workspaces
230230 workspaceDisplay = * wt .Branch
@@ -234,13 +234,13 @@ func NewListCmd() *cobra.Command {
234234 workspaceDisplay = "UNCLAIMED"
235235 workspaceColor = colorGray
236236 }
237-
237+
238238 // Add terminal hyperlink to workspace path
239239 // Format: OSC 8 ; params ; URI ST display_text OSC 8 ; ; ST
240240 // OSC = \033] ST = \033\\
241- terminalLink := fmt .Sprintf ("\033 ]8;;file://%s\033 \\ %s%s%s\033 ]8;;\033 \\ " ,
241+ terminalLink := fmt .Sprintf ("\033 ]8;;file://%s\033 \\ %s%s%s\033 ]8;;\033 \\ " ,
242242 wt .Path , workspaceColor , padRight (workspaceDisplay , workspaceWidth ), colorReset )
243-
243+
244244 // Format the row with fixed widths
245245 fmt .Printf ("%s%-*s%s %s %s%-*s%s %s%-*s%s %-*d %s%-*s%s %s%-*s%s\n " ,
246246 colorBlue , idWidth , wt .Name , colorReset ,
@@ -251,7 +251,7 @@ func NewListCmd() *cobra.Command {
251251 colorCyan , branchWidth , repo .DefaultBranch , colorReset ,
252252 colorGray , lastSyncWidth , lastFetchDisplay , colorReset )
253253 }
254-
254+
255255 // Print summary
256256 idle := 0
257257 inUse := 0
@@ -266,7 +266,7 @@ func NewListCmd() *cobra.Command {
266266 corrupt ++
267267 }
268268 }
269-
269+
270270 fmt .Printf ("\n %s%s%s\n " , colorGray , strings .Repeat ("─" , totalWidth ), colorReset )
271271 fmt .Printf ("%sSummary:%s Total: %s%d%s | Idle: %s%d%s | In-Use: %s%d%s | Corrupt: %s%d%s\n \n " ,
272272 colorBold , colorReset ,
@@ -278,4 +278,4 @@ func NewListCmd() *cobra.Command {
278278 return nil
279279 },
280280 }
281- }
281+ }
0 commit comments