Example #1
0
//Filters out files based on a pattern, if they match,
// they will be closed, otherwise sent to the output channel.
func Filter(c *slurp.C, pattern string) slurp.Stage {
	return FilterFunc(c, func(f slurp.File) bool {
		s, err := f.Stat()
		if err != nil {
			c.Errorf("Can't get File Stat: %s", err.Error())
			return false
		}
		m, err := glob.Match(pattern, s.Name())
		if err != nil {
			c.Error(err)
		}
		return m
	})
}