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

Method parseEveryDayIntervalAlias

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

Source from the content-addressed store, hash-verified

171}
172
173func (p *ScheduleParser) parseEveryDayIntervalAlias(hasWeekdaysSuffix bool) (string, bool, error) {
174 if p.tokens[1] != "day" && p.tokens[1] != "days" {
175 return "", false, nil
176 }
177 if len(p.tokens) == 2 || (len(p.tokens) == 4 && hasWeekdaysSuffix) {
178 if hasWeekdaysSuffix {
179 return "FUZZY:DAILY_WEEKDAYS * * *", true, nil
180 }
181 return "FUZZY:DAILY * * *", true, nil
182 }
183 if len(p.tokens) > 2 && p.tokens[2] == "at" {
184 timeStr, err := p.extractTime(2)
185 if err != nil {
186 return "", true, err
187 }
188 minute, hour := parseTime(timeStr)
189 if hasWeekdaysSuffix {
190 return fmt.Sprintf("%s %s * * 1-5", minute, hour), true, nil
191 }
192 return fmt.Sprintf("%s %s * * *", minute, hour), true, nil
193 }
194 return "", true, errors.New("invalid 'every day' format, use 'every day' or 'every day at HH:MM'")
195}
196
197func (p *ScheduleParser) parseLongInterval(hasWeekdaysSuffix bool) (string, error) {
198 if len(p.tokens) < p.minimumIntervalTokenCount(hasWeekdaysSuffix) {

Callers 1

parseIntervalMethod · 0.95

Calls 2

extractTimeMethod · 0.95
parseTimeFunction · 0.85

Tested by

no test coverage detected