template / files / internal / core / postscript.go
postscript.go
37160b89 2026-05-01 Pavel Safronov | 1 | package core |
fd0a4446 2023-04-03 Pavel Safronov | 2 | |
| 3 | import ( | |
| 4 | "fmt" | |
| 5 | ) | |
| 6 | ||
| 7 | func createPostScriptArrays( | |
| 8 | profile Profile, | |
| 9 | postPatternData PostPatternData) ([]string, error) { | |
| 10 | array := make([]string, 0) | |
| 11 | ||
83f12389 2026-01-15 Pavel Safronov | 12 | if len(profile.PostScripts) == 0 { |
fd0a4446 2023-04-03 Pavel Safronov | 13 | return nil, fmt.Errorf("no post scripts specified") |
| 14 | } | |
| 15 | ||
| 16 | for _, postScriptPattern := range profile.PostScripts { | |
| 17 | postScript, err := parseAndExecTemplate(newTemplate(), postScriptPattern, postPatternData) | |
| 18 | if err != nil { | |
| 19 | return nil, fmt.Errorf("error parsing post script: %w", err) | |
| 20 | } | |
| 21 | ||
| 22 | array = append(array, postScript) | |
| 23 | } | |
| 24 | ||
| 25 | return array, nil | |
| 26 | } |