diff --git a/basis/vocabs/metadata/resources/resources-docs.factor b/basis/vocabs/metadata/resources/resources-docs.factor index cb3e53c670..be5be12e75 100644 --- a/basis/vocabs/metadata/resources/resources-docs.factor +++ b/basis/vocabs/metadata/resources/resources-docs.factor @@ -6,12 +6,13 @@ HELP: copy-vocab-resources { $values { "dir" string } { "vocab" string } } { $description "Copies all the vocabs resource files to the given directory." } ; -HELP: expand-vocab-resource-files +HELP: match-patterns { $values - { "vocab" "a vocabulary specifier" } { "resource-glob-strings" "a sequence of glob patterns" } - { "filenames" "a sequence of filenames" } + { "patterns" "a sequence of glob patterns" } + { "filenames" "a sequence of filenames" } + { "filenames'" "a filtered sequence of filenames" } } -{ $description "Matches all the glob patterns in " { $snippet "resource-glob-strings" } " to the set of files inside " { $snippet "vocab" } "'s directory and outputs a sequence containing the individual files and directories that match. Any matching directories will also have their contents recursively included in the output. The paths in the output will be relative to " { $snippet "vocab" } "'s directory." } ; +{ $description "Matches all the glob patterns in " { $snippet "patterns" } " to the sequence of files in " { $snippet "filenames" } ". If a pattern doesn't match anything, then a " { $link resource-missing } " error will be thrown containing that pattern." } ; HELP: vocab-resource-files { $values @@ -23,8 +24,8 @@ HELP: vocab-resource-files ARTICLE: "vocabs.metadata.resources" "Vocabulary resource metadata" "The " { $vocab-link "vocabs.metadata.resources" } " vocabulary contains words to retrieve the full list of files that match the patterns specified in a vocabulary's " { $snippet "resources.txt" } " file." { $subsections - vocab-resource-files - expand-vocab-resource-files + match-patterns + vocab-resource-files } ; ABOUT: "vocabs.metadata.resources" diff --git a/basis/vocabs/metadata/resources/resources.factor b/basis/vocabs/metadata/resources/resources.factor index 24f0e8a7ec..beabc51cf0 100644 --- a/basis/vocabs/metadata/resources/resources.factor +++ b/basis/vocabs/metadata/resources/resources.factor @@ -24,11 +24,11 @@ PRIVATE> ERROR: resource-missing pattern ; -: match-pattern ( pattern files -- files' ) +: match-pattern ( pattern filenames -- filenames' ) over '[ _ matches? ] filter [ resource-missing ] [ nip ] if-empty ; -: match-patterns ( patterns files -- files' ) +: match-patterns ( patterns filenames -- filenames' ) '[ _ match-pattern ] map concat members ; : vocab-resource-files ( vocab -- filenames )