]> gitweb.factorcode.org Git - factor.git/blob - basis/io/directories/search/search-docs.factor
Merge branch 'master' into experimental
[factor.git] / basis / io / directories / search / search-docs.factor
1 ! Copyright (C) 2009 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: help.markup help.syntax kernel quotations ;
4 IN: io.directories.search
5
6 HELP: each-file
7 { $values
8      { "path" "a pathname string" } { "bfs?" "a boolean, breadth-first or depth-first" } { "quot" quotation }
9 }
10 { $description "Performs a directory traversal, breadth-first or depth-first, and calls the quotation on the full pathname of each file." }
11 { $examples
12     { $unchecked-example "USING: sequences io.directories.search ;"
13         "\"resource:misc\" t [ . ] each-file"
14         "! Recursive directory listing prints here"
15     }
16 } ;
17
18 HELP: recursive-directory
19 { $values
20      { "path" "a pathname string" } { "bfs?" "a boolean, breadth-first or depth-first" }
21      { "paths" "a sequence of pathname strings" }
22 }
23 { $description "Traverses a directory path recursively and returns a sequence of files in a breadth-first or depth-first manner." } ;
24
25 HELP: find-file
26 { $values
27      { "path" "a pathname string" } { "bfs?" "a boolean, breadth-first or depth-first" } { "quot" quotation }
28      { "path/f" "a pathname string or f" }
29 }
30 { $description "Finds the first file in the input directory matching the predicate quotation in a breadth-first or depth-first traversal." } ;
31
32 HELP: find-in-directories
33 { $values
34      { "directories" "a sequence of pathnames" } { "bfs?" "a boolean, breadth-first or depth-first" } { "quot" quotation }
35      { "path'/f" "a pathname string or f" }
36 }
37 { $description "Finds the first file in the input directories matching the predicate quotation in a breadth-first or depth-first traversal." } ;
38
39 HELP: find-all-files
40 { $values
41      { "path" "a pathname string" } { "bfs?" "a boolean, breadth-first or depth-first" } { "quot" quotation }
42      { "paths/f" "a sequence of pathname strings or f" }
43 }
44 { $description "Finds all files in the input directory matching the predicate quotation in a breadth-first or depth-first traversal." } ;
45
46 HELP: find-all-in-directories
47 { $values
48      { "directories" "a sequence of directory paths" } { "bfs?" "a boolean, breadth-first or depth-first" } { "quot" quotation }
49      { "paths/f" "a sequence of pathname strings or f" }
50 }
51 { $description "Finds all files in the input directories matching the predicate quotation in a breadth-first or depth-first traversal." } ;
52
53 { find-file find-all-files find-in-directories find-all-in-directories } related-words
54
55 ARTICLE: "io.directories.search" "Searching directories"
56 "The " { $vocab-link "io.directories.search" } " vocabulary contains words used for recursively iterating over a directory and for finding files in a directory tree." $nl
57 "Traversing directories:"
58 { $subsection recursive-directory }
59 { $subsection each-file }
60 "Finding files:"
61 { $subsection find-file }
62 { $subsection find-all-files }
63 { $subsection find-in-directories }
64 { $subsection find-all-in-directories } ;
65
66 ABOUT: "io.directories.search"