Original implementation is at https://github.com/matts1/rules_directory
4.6 KiB
Executable file
Skylib module containing utility functions related to directories.
directory_glob
directory_glob(directory, include, allow_empty)
native.glob, but for DirectoryInfo.
PARAMETERS
RETURNS
depset[File] A set of files that match.
directory_glob_chunk
directory_glob_chunk(directory, chunk)
Given a directory and a chunk of a glob, returns possible candidates.
PARAMETERS
Name | Description | Default Value |
---|---|---|
directory | (DirectoryInfo) The directory to look relative from. | none |
chunk | (string) A chunk of a glob to look at. | none |
RETURNS
List[Either[DirectoryInfo, File]]] The candidate next entries for the chunk.
directory_single_glob
directory_single_glob(directory, glob)
Calculates all files that are matched by a glob on a directory.
PARAMETERS
Name | Description | Default Value |
---|---|---|
directory | (DirectoryInfo) The directory to look relative from. | none |
glob | (string) A glob to match. | none |
RETURNS
List[File] A list of files that match.
get_child
get_child(directory, name, require_dir, require_file)
Gets the direct child of a directory.
PARAMETERS
RETURNS
(File|DirectoryInfo) The content contained within.
get_relative
get_relative(directory, path, require_dir, require_file)
Gets a subdirectory contained within a tree of another directory.
PARAMETERS
RETURNS
(File|DirectoryInfo) The directory contained within.
transitive_entries
transitive_entries(directory)
Returns the files and directories contained within a directory transitively.
PARAMETERS
Name | Description | Default Value |
---|---|---|
directory | (DirectoryInfo) The directory to look at | none |
RETURNS
List[Either[DirectoryInfo, File]] The entries contained within.