xref: /aosp_15_r20/external/bazel-skylib/docs/directory_utils_doc.md (revision bcb5dc7965af6ee42bf2f21341a2ec00233a8c8a)
1<!-- Generated with Stardoc: http://skydoc.bazel.build -->
2
3Skylib module containing utility functions related to directories.
4
5<a id="directory_glob"></a>
6
7## directory_glob
8
9<pre>
10directory_glob(<a href="#directory_glob-directory">directory</a>, <a href="#directory_glob-include">include</a>, <a href="#directory_glob-allow_empty">allow_empty</a>)
11</pre>
12
13native.glob, but for DirectoryInfo.
14
15**PARAMETERS**
16
17
18| Name  | Description | Default Value |
19| :------------- | :------------- | :------------- |
20| <a id="directory_glob-directory"></a>directory |  (DirectoryInfo) The directory to look relative from.   |  none |
21| <a id="directory_glob-include"></a>include |  (List[string]) A list of globs to match.   |  none |
22| <a id="directory_glob-allow_empty"></a>allow_empty |  (bool) Whether to allow a glob to not match any files.   |  `False` |
23
24**RETURNS**
25
26depset[File] A set of files that match.
27
28
29<a id="directory_glob_chunk"></a>
30
31## directory_glob_chunk
32
33<pre>
34directory_glob_chunk(<a href="#directory_glob_chunk-directory">directory</a>, <a href="#directory_glob_chunk-chunk">chunk</a>)
35</pre>
36
37Given a directory and a chunk of a glob, returns possible candidates.
38
39**PARAMETERS**
40
41
42| Name  | Description | Default Value |
43| :------------- | :------------- | :------------- |
44| <a id="directory_glob_chunk-directory"></a>directory |  (DirectoryInfo) The directory to look relative from.   |  none |
45| <a id="directory_glob_chunk-chunk"></a>chunk |  (string) A chunk of a glob to look at.   |  none |
46
47**RETURNS**
48
49List[Either[DirectoryInfo, File]]] The candidate next entries for the chunk.
50
51
52<a id="directory_single_glob"></a>
53
54## directory_single_glob
55
56<pre>
57directory_single_glob(<a href="#directory_single_glob-directory">directory</a>, <a href="#directory_single_glob-glob">glob</a>)
58</pre>
59
60Calculates all files that are matched by a glob on a directory.
61
62**PARAMETERS**
63
64
65| Name  | Description | Default Value |
66| :------------- | :------------- | :------------- |
67| <a id="directory_single_glob-directory"></a>directory |  (DirectoryInfo) The directory to look relative from.   |  none |
68| <a id="directory_single_glob-glob"></a>glob |  (string) A glob to match.   |  none |
69
70**RETURNS**
71
72List[File] A list of files that match.
73
74
75<a id="get_child"></a>
76
77## get_child
78
79<pre>
80get_child(<a href="#get_child-directory">directory</a>, <a href="#get_child-name">name</a>, <a href="#get_child-require_dir">require_dir</a>, <a href="#get_child-require_file">require_file</a>)
81</pre>
82
83Gets the direct child of a directory.
84
85**PARAMETERS**
86
87
88| Name  | Description | Default Value |
89| :------------- | :------------- | :------------- |
90| <a id="get_child-directory"></a>directory |  (DirectoryInfo) The directory to look within.   |  none |
91| <a id="get_child-name"></a>name |  (string) The name of the directory/file to look for.   |  none |
92| <a id="get_child-require_dir"></a>require_dir |  (bool) If true, throws an error if the value is not a directory.   |  `False` |
93| <a id="get_child-require_file"></a>require_file |  (bool) If true, throws an error if the value is not a file.   |  `False` |
94
95**RETURNS**
96
97(File|DirectoryInfo) The content contained within.
98
99
100<a id="get_relative"></a>
101
102## get_relative
103
104<pre>
105get_relative(<a href="#get_relative-directory">directory</a>, <a href="#get_relative-path">path</a>, <a href="#get_relative-require_dir">require_dir</a>, <a href="#get_relative-require_file">require_file</a>)
106</pre>
107
108Gets a subdirectory contained within a tree of another directory.
109
110**PARAMETERS**
111
112
113| Name  | Description | Default Value |
114| :------------- | :------------- | :------------- |
115| <a id="get_relative-directory"></a>directory |  (DirectoryInfo) The directory to look within.   |  none |
116| <a id="get_relative-path"></a>path |  (string) The path of the directory to look for within it.   |  none |
117| <a id="get_relative-require_dir"></a>require_dir |  (bool) If true, throws an error if the value is not a directory.   |  `False` |
118| <a id="get_relative-require_file"></a>require_file |  (bool) If true, throws an error if the value is not a file.   |  `False` |
119
120**RETURNS**
121
122(File|DirectoryInfo) The directory contained within.
123
124
125<a id="transitive_entries"></a>
126
127## transitive_entries
128
129<pre>
130transitive_entries(<a href="#transitive_entries-directory">directory</a>)
131</pre>
132
133Returns the files and directories contained within a directory transitively.
134
135**PARAMETERS**
136
137
138| Name  | Description | Default Value |
139| :------------- | :------------- | :------------- |
140| <a id="transitive_entries-directory"></a>directory |  (DirectoryInfo) The directory to look at   |  none |
141
142**RETURNS**
143
144List[Either[DirectoryInfo, File]] The entries contained within.
145
146
147