| 784 | } |
| 785 | |
| 786 | func (node *ModTreeNode) Match(ctx context.Context, patterns []string) (bool, error) { |
| 787 | if node.Parent == nil { |
| 788 | // The root node matches everything |
| 789 | return true, nil |
| 790 | } |
| 791 | if len(patterns) == 0 { |
| 792 | return true, nil |
| 793 | } |
| 794 | for _, pattern := range patterns { |
| 795 | if match, err := node.Path().Glob(ctx, pattern); err != nil { |
| 796 | return false, err |
| 797 | } else if match { |
| 798 | return true, nil |
| 799 | } |
| 800 | patternAsPath := NewModTreePath(pattern) |
| 801 | if patternAsPath.Contains(ctx, node.Path()) { |
| 802 | return true, nil |
| 803 | } |
| 804 | } |
| 805 | return false, nil |
| 806 | } |
| 807 | |
| 808 | func (node *ModTreeNode) PathString() string { |
| 809 | return strings.Join(node.Path().CliCase(), ":") |