@@ -7,8 +7,10 @@ import (
77 "os"
88 "path/filepath"
99 "strings"
10+ "time"
1011
1112 "github.com/andygrunwald/go-jira"
13+ "github.com/briandowns/spinner"
1214 tea "github.com/charmbracelet/bubbletea"
1315 "github.com/charmbracelet/lipgloss"
1416 "github.com/rs/zerolog/log"
2628 flakyTestJSONDBPath string
2729)
2830
29- // CreateTicketsCmd is the Cobra command that runs a Bubble Tea TUI for CSV data,
30- // creates (or references) tickets in Jira, and writes a new CSV omitting confirmed rows.
3131var CreateTicketsCmd = & cobra.Command {
3232 Use : "create-tickets" ,
3333 Short : "Interactive TUI to confirm and create Jira tickets from CSV" ,
@@ -96,7 +96,6 @@ ticket in a text-based UI. Press 'y' to confirm creation, 'n' to skip,
9696 ft .RowIndex = i + 1
9797
9898 // Check local DB for known Jira ticket
99- // Always check local DB for known Jira ticket (even for invalid tests)
10099 if ticketID , found := db .Get (ft .TestPackage , ft .TestName ); found {
101100 ft .ExistingJiraKey = ticketID
102101 ft .ExistingTicketSource = "localdb"
@@ -117,6 +116,10 @@ ticket in a text-based UI. Press 'y' to confirm creation, 'n' to skip,
117116
118117 // 6) If we have a Jira client, do label-based search for existing tickets
119118 if client != nil {
119+ s := spinner .New (spinner .CharSets [14 ], 100 * time .Millisecond )
120+ s .Suffix = " Searching for existing jira tickets..."
121+ s .Start ()
122+
120123 for i := range tickets {
121124 t := & tickets [i ]
122125 if t .ExistingJiraKey == "" {
@@ -130,6 +133,7 @@ ticket in a text-based UI. Press 'y' to confirm creation, 'n' to skip,
130133 }
131134 }
132135 }
136+ s .Stop ()
133137 }
134138
135139 // 7) Create Bubble Tea model
@@ -153,7 +157,6 @@ ticket in a text-based UI. Press 'y' to confirm creation, 'n' to skip,
153157 if err := fm .LocalDB .Save (); err != nil {
154158 log .Error ().Err (err ).Msg ("Failed to save local DB" )
155159 } else {
156- // Let the user know we updated it
157160 fmt .Printf ("Local DB has been updated at: %s\n " , fm .LocalDB .FilePath ())
158161 }
159162
0 commit comments