Glob

object Glob
Companion
class
class Object
trait Matchable
class Any

Type members

Classlikes

final
class FileOps(val file: File) extends AnyVal

Provides extension methods to java.nio.file.Path

Provides extension methods to java.nio.file.Path

Value Params
file

the File instance to extend.

final implicit
class GlobOps(val glob: Glob) extends AnyVal

Provides extension methods for Glob.

Provides extension methods for Glob.

Value Params
glob

the Glob to augment.

final implicit
class PathFilterOps(val glob: Glob) extends AnyVal with PathFilterExtensions

Provides extension methods to Glob that allows it to create combined sbt.nio.file.PathFilter instances with && and ||.

Provides extension methods to Glob that allows it to create combined sbt.nio.file.PathFilter instances with && and ||.

Value Params
glob

the Glob to extend

final
class PathOps(val path: Path) extends AnyVal

Provides extension methods to java.nio.file.Path.

Provides extension methods to java.nio.file.Path.

Value Params
path

the Path instance to extend.

object ordering extends Ordering[Glob]

Provides a default ordering for glob. Globs with a path prefix precede relative globs and are sorted by their path prefix.

Provides a default ordering for glob. Globs with a path prefix precede relative globs and are sorted by their path prefix.

Value members

Concrete methods

def apply(file: File): Glob

Construct a single file Glob. The resulting Glob will only match the input file.

Construct a single file Glob. The resulting Glob will only match the input file.

Value Params
file

the single path to match.

Returns

a Glob whose Glob.matches method only accepts the input path.

def apply(file: File, relative: String): Glob

Construct a Glob with a file prefix and relativeGlob glob string. For example:

Construct a Glob with a file prefix and relativeGlob glob string. For example:

 val glob = Glob(file("foo/bar"), "*.txt") // matches all txt files in foo/bar
 val recursiveGlob = Glob(file("foo/bar"), "**<code>/</code>*.txt") // recursively matches all text files in foo/bar
Value Params
file

the prefix of the glob pattern. This can be an absolute or relativeGlob file.

relative

the relativeGlob glob string

Returns

a Glob that matches the file prefix with

def apply(file: File, relativeGlob: RelativeGlob): Glob

Construct a Glob with a file prefix and a RelativeGlob suffix. In order for a path to match the output Glob, it must start with file and its relative path with respect to file must match the relativeGlob. For example:

Construct a Glob with a file prefix and a RelativeGlob suffix. In order for a path to match the output Glob, it must start with file and its relative path with respect to file must match the relativeGlob. For example:

 val txtFiles = Glob(file("foo/bar"), * / "*.txt") // matches all text files in any subdirectory of foo/bar
 val allChildren = Glob(file("/foo/bar"), **) // matches all descendants of /foo/bar
 val scalaSources = Glob(file("src/main/scala", ** / "*.scala")) // matches scala source file
Value Params
file

the prefix of the glob pattern. This can be an absolute or relativeGlob file.

relativeGlob

the RelativeGlob to append to the file prefix

Returns

a Glob that matches a path with the same prefix as file and whose suffix matches relativeGlob.

def apply(file: File, regex: Regex): Glob

Appends a relative glob specified by a regex pattern to an existing Glob. For example:

Appends a relative glob specified by a regex pattern to an existing Glob. For example:

 val scalaSources = Glob(file("foo/bar"), "^[^.].*\\.scala".r
 scalaSources.matches(Paths.get("foo/bar/Foo.scala")) // true
 scalaSources.matches(Paths.get("foo/bar/.hidden.scala")) // false

Note that on Windows, \ will be treated as a regex escape character but / will be treated as a path separator.

Value Params
file

the file prefix of the pattern

regex

the pattern to apply

Returns

a Glob with the new RelativeGlob appended to the query.

def apply(path: Path): Glob

Construct a single path Glob. The resulting glob

Construct a single path Glob. The resulting glob

Value Params
path

the single path to match.

Returns

a Glob whose Glob.matches method only accepts the input path.

def apply(path: Path, relativeGlob: RelativeGlob): Glob

Construct a Glob with a path prefix and a RelativeGlob. For example:

Construct a Glob with a path prefix and a RelativeGlob. For example:

 val txtFiles = Glob(Paths.get("foo/bar"), * / "*.txt") // matches all text files in any subdirectory of foo/bar
 val allChildren = Glob(Paths.get("/foo/bar"), **) // matches all descendants of /foo/bar
 val scalaSources = Glob(Paths.get("src/main/scala", ** / "*.scala")) // matches scala source file
Value Params
path

the prefix of the glob pattern. This can be an absolute or relativeGlob file.

relativeGlob

the RelativeGlob to append to the file prefix

Returns

a Glob that matches the file prefix with

def apply(path: Path, relative: String): Glob

Construct a Glob with a file prefix and relativeGlob glob string. For example:

Construct a Glob with a file prefix and relativeGlob glob string. For example:

 val glob = Glob(file("foo/bar"), "*.txt") // matches all text files in foo/bar
Value Params
path

the prefix of the glob pattern. This can be an absolute or relativeGlob file.

relative

the relativeGlob glob string

Returns

a Glob that matches the file prefix with

def apply(path: Path, regex: Regex): Glob

Appends a relative glob specified by a regex pattern to an existing Glob. For example:

Appends a relative glob specified by a regex pattern to an existing Glob. For example:

 val scalaSources = Glob(file("foo/bar"), "^[^.].*\\.scala".r
 scalaSources.matches(Paths.get("foo/bar/Foo.scala")) // true
 scalaSources.matches(Paths.get("foo/bar/.hidden.scala")) // false

Note that on Windows, \ will be treated as a regex escape character but / will be treated as a path separator.

Value Params
path

the file path prefix of the pattern

regex

the pattern to apply

Returns

a Glob with the new RelativeGlob appended to the query.

def apply(glob: String): Glob

Construct a glob from a string. It can represent a full path. Any / characters in a pathname are automatically converted to \\ on windows.

Construct a glob from a string. It can represent a full path. Any / characters in a pathname are automatically converted to \\ on windows.

 val absoluteGlob = Glob("/foo/bar<code>/</code>**<code>/</code>*.txt")
 val relativeGlob = Glob("*<code>/</code>*.txt")
Value Params
glob

the string to convert to a glob

Returns

a parsed Glob for the input. May throw if the input cannot be parsed into a Glob.

Implicits

Implicits

final implicit
def GlobOps(glob: Glob): GlobOps

Provides extension methods for Glob.

Provides extension methods for Glob.

Value Params
glob

the Glob to augment.

final implicit

Provides extension methods to Glob that allows it to create combined sbt.nio.file.PathFilter instances with && and ||.

Provides extension methods to Glob that allows it to create combined sbt.nio.file.PathFilter instances with && and ||.

Value Params
glob

the Glob to extend

implicit
def stringToGlob(glob: String): Glob

Converts a string to a Glob.

Converts a string to a Glob.

Value Params
glob

the string to convert

Returns

the converted Glob.