Helper function to slugify a string for filenames
(s string)
| 1062 | |
| 1063 | // Helper function to slugify a string for filenames |
| 1064 | func slugify(s string) string { |
| 1065 | // Convert to lowercase |
| 1066 | s = strings.ToLower(s) |
| 1067 | // Replace spaces with hyphens |
| 1068 | s = strings.ReplaceAll(s, " ", "-") |
| 1069 | // Remove any non-alphanumeric characters |
| 1070 | s = regexp.MustCompile(`[^a-z0-9-]`).ReplaceAllString(s, "") |
| 1071 | return s |
| 1072 | } |
| 1073 | |
| 1074 | // Helper function to add a line to a crontab file |
| 1075 | func addLineToCrontab(file string, line string) error { |