github.com/tilt-dev/tilt@v0.33.15-0.20240515162809-0a22ed45d8a0/pkg/model/watch_settings.go (about) 1 package model 2 3 import "github.com/tilt-dev/tilt/pkg/apis/core/v1alpha1" 4 5 type WatchSettings struct { 6 Ignores []Dockerignore 7 } 8 9 func (ws WatchSettings) Empty() bool { 10 return len(ws.Ignores) == 0 11 } 12 13 type Dockerignore struct { 14 // The path to evaluate the dockerignore contents relative to 15 LocalPath string 16 17 // A human-readable string that identifies where the ignores come from. 18 Source string 19 20 // Patterns parsed out of the .dockerignore file. 21 Patterns []string 22 } 23 24 func (d Dockerignore) Empty() bool { 25 return len(d.Patterns) == 0 26 } 27 28 func DockerignoresToIgnores(source []Dockerignore) []v1alpha1.IgnoreDef { 29 result := make([]v1alpha1.IgnoreDef, 0, len(source)) 30 for _, s := range source { 31 if s.Empty() { 32 continue 33 } 34 result = append(result, v1alpha1.IgnoreDef{ 35 BasePath: s.LocalPath, 36 Patterns: s.Patterns, 37 }) 38 } 39 return result 40 }