2017-11-08 07:28:33 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
type RouteSubset struct {
|
2022-02-21 03:32:53 +00:00
|
|
|
RouteList []*RouteImpl
|
2017-11-08 07:28:33 +00:00
|
|
|
}
|
|
|
|
|
2017-11-10 03:33:11 +00:00
|
|
|
func (set *RouteSubset) Before(lines ...string) *RouteSubset {
|
2022-02-21 03:32:53 +00:00
|
|
|
for _, line := range lines {
|
|
|
|
for _, r := range set.RouteList {
|
|
|
|
r.RunBefore = append(r.RunBefore, Runnable{line, false})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return set
|
2017-11-10 03:33:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (set *RouteSubset) LitBefore(lines ...string) *RouteSubset {
|
2022-02-21 03:32:53 +00:00
|
|
|
for _, line := range lines {
|
|
|
|
for _, r := range set.RouteList {
|
|
|
|
r.RunBefore = append(r.RunBefore, Runnable{line, true})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return set
|
2017-11-08 07:28:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (set *RouteSubset) Not(path ...string) *RouteSubset {
|
2022-02-21 03:32:53 +00:00
|
|
|
for i, route := range set.RouteList {
|
|
|
|
if inStringList(route.Path, path) {
|
|
|
|
set.RouteList = append(set.RouteList[:i], set.RouteList[i+1:]...)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return set
|
2017-11-08 07:28:33 +00:00
|
|
|
}
|