FsMake


Glob Module

Module for creating and working with a Glob.

A Glob represents a set of patterns to include/exclude files.

Example

 // search recursively for all files with a .dll file extension
 let dlls = Glob.create "**/*.dll" |> Glob.toPaths

Types

Type Description

PathType

Used to represent the type of path.

Functions and values

Function or value Description

add pattern glob

Full Usage: add pattern glob

Parameters:
    pattern : string - The pattern of paths to include.
    glob : Glob - The Glob.

Returns: Glob An updated Glob.

Adds a pattern of paths to include to an existing Glob.

pattern : string

The pattern of paths to include.

glob : Glob

The Glob.

Returns: Glob

An updated Glob.

Example

 let cleanDirs =
     Glob.create "**/bin"
     |> Glob.add "**/obj"

create pattern

Full Usage: create pattern

Parameters:
    pattern : string - The pattern of paths to include.

Returns: Glob The new Glob.

Creates a Glob from a pattern.

pattern : string

The pattern of paths to include.

Returns: Glob

The new Glob.

Example

 let dlls = Glob.create "**/*.dll"

createWithRootDir directory pattern

Full Usage: createWithRootDir directory pattern

Parameters:
    directory : string - The root directory.
    pattern : string - The pattern of paths to include.

Returns: Glob The new Glob.

Creates a Glob from a pattern with a root directory. The root directory is the path of a directory to start searching from.

directory : string

The root directory.

pattern : string

The pattern of paths to include.

Returns: Glob

The new Glob.

Example

 let logs = Glob.createWithRootDir "/tmp" "**/*.log"

exclude pattern glob

Full Usage: exclude pattern glob

Parameters:
    pattern : string - The pattern of paths to exclude.
    glob : Glob - The Glob.

Returns: Glob An updated Glob.

Adds a pattern of paths to exclude to an existing Glob.

pattern : string

The pattern of paths to exclude.

glob : Glob

The Glob.

Returns: Glob

An updated Glob.

Example

 let dlls =
     Glob.create "**/*.dll"
     |> Glob.exclude "exclude.dll"

toPathTypes glob

Full Usage: toPathTypes glob

Parameters:
    glob : Glob - The Glob to create the paths from.

Returns: seq<PathType> A sequence of matched paths.

Creates a sequence of PathType from a Glob.

glob : Glob

The Glob to create the paths from.

Returns: seq<PathType>

A sequence of matched paths.

Example

 Glob.create "**/*Things*"
 |> Glob.toPathTypes
 |> Seq.iter
     (function
     | Glob.File x -> printfn "File path: %s" x
     | Glob.Directory x -> printfn "Directory path: %s" x)

toPaths glob

Full Usage: toPaths glob

Parameters:
    glob : Glob - The Glob to create the paths from.

Returns: seq<string> A sequence of matched paths.

Creates a sequence of matched paths from a Glob.

glob : Glob

The Glob to create the paths from.

Returns: seq<string>

A sequence of matched paths.

Example

 let dllPaths = Glob.create "**/*.dll" |> Glob.toPaths