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

Method parseBase

pkg/parser/schedule_parser.go:113–139  ·  view source on GitHub ↗

parseBase parses base schedules like "daily", "weekly on monday", etc.

()

Source from the content-addressed store, hash-verified

111
112// parseBase parses base schedules like "daily", "weekly on monday", etc.
113func (p *ScheduleParser) parseBase() (string, error) {
114 if len(p.tokens) == 0 {
115 return "", errors.New("empty schedule")
116 }
117
118 baseType := p.tokens[0]
119 scheduleLog.Printf("Parsing base schedule: type=%s, tokens=%v", baseType, p.tokens)
120 hasWeekdaysSuffix := p.hasWeekdaysSuffix()
121
122 switch baseType {
123 case "daily":
124 return p.parseDailyBase(hasWeekdaysSuffix)
125 case "hourly":
126 return p.parseHourlyBase(hasWeekdaysSuffix)
127 case "weekly":
128 return p.parseWeeklyBase()
129 case "bi-weekly":
130 return p.parseNamedFuzzyBase("bi-weekly", "FUZZY:BI_WEEKLY * * *")
131 case "tri-weekly":
132 return p.parseNamedFuzzyBase("tri-weekly", "FUZZY:TRI_WEEKLY * * *")
133 case "monthly":
134 return p.parseMonthlyBase()
135
136 default:
137 return "", fmt.Errorf("unsupported schedule type '%s', use 'daily', 'hourly', 'weekly', 'bi-weekly', 'tri-weekly', or 'monthly'", baseType)
138 }
139}
140
141func (p *ScheduleParser) parseShortDurationInterval(hasWeekdaysSuffix bool) (string, bool, error) {
142 if !p.usesShortDurationSyntax(hasWeekdaysSuffix) {

Callers 1

parseMethod · 0.95

Calls 8

hasWeekdaysSuffixMethod · 0.95
parseDailyBaseMethod · 0.95
parseHourlyBaseMethod · 0.95
parseWeeklyBaseMethod · 0.95
parseNamedFuzzyBaseMethod · 0.95
parseMonthlyBaseMethod · 0.95
PrintfMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected