(content string, opts AddOptions)
| 602 | } |
| 603 | |
| 604 | func applyStopAfterModifications(content string, opts AddOptions) (string, error) { |
| 605 | // Handle stop-after field modifications |
| 606 | if opts.NoStopAfter { |
| 607 | cleanedContent, err := RemoveFieldFromOnTrigger(content, "stop-after") |
| 608 | if err != nil { |
| 609 | if opts.Verbose { |
| 610 | fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Failed to remove stop-after field: %v", err))) |
| 611 | } |
| 612 | return content, nil |
| 613 | } |
| 614 | if opts.Verbose { |
| 615 | fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Removed stop-after field from workflow")) |
| 616 | } |
| 617 | return cleanedContent, nil |
| 618 | } |
| 619 | if opts.StopAfter == "" { |
| 620 | return content, nil |
| 621 | } |
| 622 | |
| 623 | updatedContent, err := SetFieldInOnTrigger(content, "stop-after", opts.StopAfter) |
| 624 | if err != nil { |
| 625 | if opts.Verbose { |
| 626 | fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Failed to set stop-after field: %v", err))) |
| 627 | } |
| 628 | return content, nil |
| 629 | } |
| 630 | if opts.Verbose { |
| 631 | fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Set stop-after field to: "+opts.StopAfter)) |
| 632 | } |
| 633 | return updatedContent, nil |
| 634 | } |
| 635 | |
| 636 | func trackAndWriteWorkflowFile(destFile string, content string, fileExists bool, opts AddOptions, tracker *FileTracker) error { |
| 637 | if tracker != nil { |
no test coverage detected