You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
389 B
Go
23 lines
389 B
Go
package startimer
|
|
|
|
import (
|
|
"errors"
|
|
"strings"
|
|
)
|
|
|
|
func parseCron(cron string) (StarTimer, error) {
|
|
for {
|
|
oldLen := len(cron)
|
|
cron = strings.ReplaceAll(strings.TrimSpace(cron), " ", " ")
|
|
if len(cron) == oldLen {
|
|
break
|
|
}
|
|
}
|
|
ct := strings.Split(cron, " ")
|
|
if len(ct) != 6 {
|
|
return StarTimer{}, errors.New("Invalid cron,argument not enough")
|
|
}
|
|
|
|
return StarTimer{}, nil
|
|
}
|