package dune-glob
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=b1a86b2d60bdb4a8b9bb6861bdf2f9f28a6e7cb5d833ce81afecceb9ef9ca549
sha512=ed14df9163e487d4ae7d0a2427eaab7823ef1f0ef2d93f0b783e6f163bbd5b44ba73f055d60b84e76f476fe11d38e794013628a1da776d9ec13cca9666e7b7ff
doc/index.html
dune-glob - file globbing
Introduction
A glob is a way of referring to a set of files that match a certain pattern, such as "files with the .ml
extension" or "files with test
in their name".
dune-glob
exposes an abstraction so that we can refer to the first group as *.ml
and the second one as *test*
.
This library is used by Dune to implement this syntax in several places in dune
files, but it can be used in other contexts as well.
Example
This is an executable that takes a glob as a command line argument, and lists the contents of the current directory that matches it:
let () =
let glob_string = Sys.argv.(1) in
let glob = Dune_glob.V1.of_string glob_string in
let files = Sys.readdir "." in
ArrayLabels.iter files ~f:(fun n ->
if Dune_glob.V1.test glob n then
print_endline n)
API documentation
The entry point for this library is Dune_glob.V1
.
Note on stability
This library is fairly stable, but does not come with strong stability guarantees. In particular, while the module name suggests the API is versioned, it is not in the strict sense.