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

Method parseLongIntervalParts

pkg/parser/schedule_parser.go:222–237  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

220}
221
222func (p *ScheduleParser) parseLongIntervalParts() (int, string, error) {
223 intervalStr := p.tokens[1]
224 interval, err := strconv.Atoi(intervalStr)
225 if err != nil || interval < 1 {
226 return 0, "", fmt.Errorf("invalid interval '%s', must be a positive integer", intervalStr)
227 }
228
229 unit := p.tokens[2]
230 if !strings.HasSuffix(unit, "s") {
231 unit += "s"
232 }
233 if unit != "minutes" && unit != "hours" && unit != "days" {
234 return 0, "", fmt.Errorf("unsupported interval unit '%s', use 'minutes', 'hours', or 'days'", unit)
235 }
236 return interval, unit, nil
237}
238
239func (p *ScheduleParser) validateIntervalTimeClause(startPos int, hasWeekdaysSuffix bool) error {
240 endPos := len(p.tokens)

Callers 1

parseLongIntervalMethod · 0.95

Calls 1

ErrorfMethod · 0.45

Tested by

no test coverage detected