MCPcopy Create free account
hub / github.com/dagger/dagger / matchWorkspaceIncludePath

Function matchWorkspaceIncludePath

core/schema/workspace.go:796–819  ·  view source on GitHub ↗
(
	ctx context.Context,
	path core.ModTreePath,
	include []string,
)

Source from the content-addressed store, hash-verified

794}
795
796func matchWorkspaceIncludePath(
797 ctx context.Context,
798 path core.ModTreePath,
799 include []string,
800) (bool, error) {
801 if len(include) == 0 {
802 return true, nil
803 }
804 if len(path) == 0 {
805 return false, nil
806 }
807 for _, pattern := range include {
808 if match, err := path.Glob(ctx, pattern); err != nil {
809 return false, err
810 } else if match {
811 return true, nil
812 }
813 patternAsPath := core.NewModTreePath(pattern)
814 if patternAsPath.Contains(ctx, path) {
815 return true, nil
816 }
817 }
818 return false, nil
819}
820
821func currentWorkspacePrimaryModules(ctx context.Context) ([]dagql.ObjectResult[*core.Module], error) {
822 query, err := core.CurrentQuery(ctx)

Callers 1

matchSingleModuleIncludeFunction · 0.85

Calls 3

ContainsMethod · 0.95
NewModTreePathFunction · 0.92
GlobMethod · 0.45

Tested by

no test coverage detected