@@ -138,12 +138,12 @@ var (
138138 }
139139)
140140
141- func requireProject (ctx context.Context , cmd * cli.Command ) error {
141+ func requireProject (ctx context.Context , cmd * cli.Command ) (context. Context , error ) {
142142 var err error
143143 if project , err = loadProjectDetails (cmd ); err != nil {
144- if err = loadProjectConfig (ctx , cmd ); err != nil {
144+ if _ , err = loadProjectConfig (ctx , cmd ); err != nil {
145145 // something is wrong with config file
146- return err
146+ return nil , err
147147 }
148148
149149 // choose from existing credentials or authenticate
@@ -157,33 +157,33 @@ func requireProject(ctx context.Context, cmd *cli.Command) error {
157157 Description ("If you'd like to use a different project, run `lk cloud auth` to add credentials" ).
158158 Options (options ... ).
159159 Value (& project ).
160- WithTheme (theme ).
160+ WithTheme (util . Theme ).
161161 Run (); err != nil {
162- return err
162+ return nil , err
163163 }
164164 } else {
165165 shouldAuth := true
166166 if err = huh .NewConfirm ().
167167 Title ("No local projects found. Authenticate one now?" ).
168168 Inline (true ).
169169 Value (& shouldAuth ).
170- WithTheme (theme ).
170+ WithTheme (util . Theme ).
171171 Run (); err != nil {
172- return err
172+ return nil , err
173173 }
174174 if shouldAuth {
175175 initAuth (ctx , cmd )
176176 if err = tryAuthIfNeeded (ctx , cmd ); err != nil {
177- return err
177+ return nil , err
178178 }
179179 return requireProject (ctx , cmd )
180180 } else {
181- return errors .New ("no project selected" )
181+ return nil , errors .New ("no project selected" )
182182 }
183183 }
184184 }
185185
186- return err
186+ return nil , err
187187}
188188
189189func listTemplates (ctx context.Context , cmd * cli.Command ) error {
@@ -196,11 +196,11 @@ func listTemplates(ctx context.Context, cmd *cli.Command) error {
196196 util .PrintJSON (templates )
197197 } else {
198198 const maxDescLength = 64
199- table := CreateTable ().Headers ("Template" , "Description" ).BorderRow (true )
199+ table := util . CreateTable ().Headers ("Template" , "Description" ).BorderRow (true )
200200 for _ , t := range templates {
201201 desc := strings .Join (util .WrapToLines (t .Desc , maxDescLength ), "\n " )
202- url := theme .Focused .Title .Render (t .URL )
203- tags := theme .Help .ShortDesc .Render ("#" + strings .Join (t .Tags , " #" ))
202+ url := util . Theme .Focused .Title .Render (t .URL )
203+ tags := util . Theme .Help .ShortDesc .Render ("#" + strings .Join (t .Tags , " #" ))
204204 table .Row (
205205 t .Name ,
206206 desc + "\n \n " + url + "\n " + tags ,
@@ -251,10 +251,10 @@ func setupTemplate(ctx context.Context, cmd *cli.Command) error {
251251 templateSelect := huh .NewSelect [string ]().
252252 Title ("Select Template" ).
253253 Value (& templateURL ).
254- WithTheme (theme )
254+ WithTheme (util . Theme )
255255 var options []huh.Option [string ]
256256 for _ , t := range templateOptions {
257- descStyle := theme .Help .ShortDesc
257+ descStyle := util . Theme .Help .ShortDesc
258258 optionText := t .Name + " " + descStyle .Render ("#" + strings .Join (t .Tags , " #" ))
259259 options = append (options , huh .NewOption (optionText , t .URL ))
260260 }
@@ -293,13 +293,13 @@ func setupTemplate(ctx context.Context, cmd *cli.Command) error {
293293 }
294294 return nil
295295 }).
296- WithTheme (theme ))
296+ WithTheme (util . Theme ))
297297 }
298298
299299 if len (preinstallPrompts ) > 0 {
300300 group := huh .NewGroup (preinstallPrompts ... )
301301 if err := huh .NewForm (group ).
302- WithTheme (theme ).
302+ WithTheme (util . Theme ).
303303 RunWithContext (ctx ); err != nil {
304304 return err
305305 }
@@ -364,7 +364,7 @@ func cloneTemplate(_ context.Context, cmd *cli.Command, url, appName string) err
364364 Action (func () {
365365 stdout , stderr , cmdErr = bootstrap .CloneTemplate (url , tempName )
366366 }).
367- Style (theme .Focused .Title ).
367+ Style (util . Theme .Focused .Title ).
368368 Run (); err != nil {
369369 return err
370370 }
@@ -424,7 +424,7 @@ func instantiateEnv(ctx context.Context, cmd *cli.Command, rootPath string, addl
424424 Title ("Enter " + key + "?" ).
425425 Placeholder (oldValue ).
426426 Value (& newValue ).
427- WithTheme (theme ).
427+ WithTheme (util . Theme ).
428428 Run (); err != nil || newValue == "" {
429429 return oldValue , err
430430 }
@@ -485,7 +485,7 @@ func doInstall(ctx context.Context, task bootstrap.KnownTask, rootPath string, v
485485 if err := spinner .New ().
486486 Title ("Installing..." ).
487487 Action (func () { cmdErr = install () }).
488- Style (theme .Focused .Title ).
488+ Style (util . Theme .Focused .Title ).
489489 Accessible (true ).
490490 Run (); err != nil {
491491 return err
@@ -512,7 +512,7 @@ func runTask(ctx context.Context, cmd *cli.Command) error {
512512 Title ("Select Task" ).
513513 Options (options ... ).
514514 Value (& taskName ).
515- WithTheme (theme ).
515+ WithTheme (util . Theme ).
516516 Run (); err != nil {
517517 return err
518518 }
@@ -526,7 +526,7 @@ func runTask(ctx context.Context, cmd *cli.Command) error {
526526 if err := spinner .New ().
527527 Title ("Running task " + taskName + "..." ).
528528 Action (func () { cmdErr = task () }).
529- Style (theme .Focused .Title ).
529+ Style (util . Theme .Focused .Title ).
530530 Accessible (verbose ).
531531 Run (); err != nil {
532532 return err
0 commit comments