@@ -307,7 +307,7 @@ func loadOrCreateInstance(cmd *cobra.Command, args []string, createOnly bool) (*
307307 return nil , err
308308 }
309309 } else {
310- tmpl , err = limatmpl .Read (cmd . Context () , name , arg )
310+ tmpl , err = limatmpl .Read (ctx , name , arg )
311311 if err != nil {
312312 return nil , err
313313 }
@@ -321,7 +321,7 @@ func loadOrCreateInstance(cmd *cobra.Command, args []string, createOnly bool) (*
321321 }
322322 }
323323
324- if err := tmpl .Embed (cmd . Context () , true , true ); err != nil {
324+ if err := tmpl .Embed (ctx , true , true ); err != nil {
325325 return nil , err
326326 }
327327 yqExprs , err := editflags .YQExpressions (flags , true )
@@ -331,18 +331,18 @@ func loadOrCreateInstance(cmd *cobra.Command, args []string, createOnly bool) (*
331331 yq := yqutil .Join (yqExprs )
332332 if tty {
333333 var err error
334- tmpl , err = chooseNextCreatorState (cmd . Context () , tmpl , yq )
334+ tmpl , err = chooseNextCreatorState (ctx , tmpl , yq )
335335 if err != nil {
336336 return nil , err
337337 }
338338 } else {
339339 logrus .Info ("Terminal is not available, proceeding without opening an editor" )
340- if err := modifyInPlace (tmpl , yq ); err != nil {
340+ if err := modifyInPlace (ctx , tmpl , yq ); err != nil {
341341 return nil , err
342342 }
343343 }
344344 saveBrokenYAML := tty
345- return instance .Create (cmd . Context () , tmpl .Name , tmpl .Bytes , saveBrokenYAML )
345+ return instance .Create (ctx , tmpl .Name , tmpl .Bytes , saveBrokenYAML )
346346}
347347
348348func applyYQExpressionToExistingInstance (ctx context.Context , inst * limatype.Instance , yq string ) (* limatype.Instance , error ) {
@@ -355,7 +355,7 @@ func applyYQExpressionToExistingInstance(ctx context.Context, inst *limatype.Ins
355355 return nil , err
356356 }
357357 logrus .Debugf ("Applying yq expression %q to an existing instance %q" , yq , inst .Name )
358- yBytes , err := yqutil .EvaluateExpression (yq , yContent )
358+ yBytes , err := yqutil .EvaluateExpression (ctx , yq , yContent )
359359 if err != nil {
360360 return nil , err
361361 }
@@ -381,8 +381,8 @@ func applyYQExpressionToExistingInstance(ctx context.Context, inst *limatype.Ins
381381 return store .Inspect (ctx , inst .Name )
382382}
383383
384- func modifyInPlace (st * limatmpl.Template , yq string ) error {
385- out , err := yqutil .EvaluateExpression (yq , st .Bytes )
384+ func modifyInPlace (ctx context. Context , st * limatmpl.Template , yq string ) error {
385+ out , err := yqutil .EvaluateExpression (ctx , yq , st .Bytes )
386386 if err != nil {
387387 return err
388388 }
@@ -407,7 +407,7 @@ func (exitSuccessError) ExitCode() int {
407407
408408func chooseNextCreatorState (ctx context.Context , tmpl * limatmpl.Template , yq string ) (* limatmpl.Template , error ) {
409409 for {
410- if err := modifyInPlace (tmpl , yq ); err != nil {
410+ if err := modifyInPlace (ctx , tmpl , yq ); err != nil {
411411 logrus .WithError (err ).Warn ("Failed to evaluate yq expression" )
412412 return tmpl , err
413413 }
0 commit comments