MCPcopy Create free account
hub / github.com/github/gh-aw / parseLongInterval

Method parseLongInterval

pkg/parser/schedule_parser.go:197–213  ·  view source on GitHub ↗
(hasWeekdaysSuffix bool)

Source from the content-addressed store, hash-verified

195}
196
197func (p *ScheduleParser) parseLongInterval(hasWeekdaysSuffix bool) (string, error) {
198 if len(p.tokens) < p.minimumIntervalTokenCount(hasWeekdaysSuffix) {
199 return "", errors.New("invalid interval format, expected 'every N unit' or 'every Nunit' (e.g., 'every 2h')")
200 }
201
202 interval, unit, err := p.parseLongIntervalParts()
203 if err != nil {
204 return "", err
205 }
206 if err := p.validateIntervalTimeClause(3, hasWeekdaysSuffix); err != nil {
207 return "", err
208 }
209 if err := validateMinimumInterval(interval, unit); err != nil {
210 return "", err
211 }
212 return formatLongIntervalCron(interval, unit, hasWeekdaysSuffix)
213}
214
215func (p *ScheduleParser) minimumIntervalTokenCount(hasWeekdaysSuffix bool) int {
216 if hasWeekdaysSuffix {

Callers 1

parseIntervalMethod · 0.95

Calls 5

validateMinimumIntervalFunction · 0.85
formatLongIntervalCronFunction · 0.85

Tested by

no test coverage detected