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

Method parseInterval

pkg/parser/schedule_parser.go:93–110  ·  view source on GitHub ↗

parseInterval parses interval-based schedules like "every 10 minutes" or "every 2h"

()

Source from the content-addressed store, hash-verified

91
92// parseInterval parses interval-based schedules like "every 10 minutes" or "every 2h"
93func (p *ScheduleParser) parseInterval() (string, error) {
94 if len(p.tokens) < 2 {
95 return "", errors.New("invalid interval format, expected 'every N unit' or 'every Nunit'")
96 }
97 scheduleLog.Printf("Parsing interval schedule: tokens=%v", p.tokens)
98
99 hasWeekdaysSuffix := p.hasWeekdaysSuffix()
100
101 if cronExpr, handled, err := p.parseShortDurationInterval(hasWeekdaysSuffix); handled || err != nil {
102 return cronExpr, err
103 }
104
105 if cronExpr, handled, err := p.parseEveryDayIntervalAlias(hasWeekdaysSuffix); handled || err != nil {
106 return cronExpr, err
107 }
108
109 return p.parseLongInterval(hasWeekdaysSuffix)
110}
111
112// parseBase parses base schedules like "daily", "weekly on monday", etc.
113func (p *ScheduleParser) parseBase() (string, error) {

Callers 1

parseMethod · 0.95

Calls 5

hasWeekdaysSuffixMethod · 0.95
parseLongIntervalMethod · 0.95
PrintfMethod · 0.45

Tested by

no test coverage detected