A .dockerignore matcher for Elixir with semantics pinned to
moby/patternmatcher v0.6.1.
Examples
iex> source = "_build/\n*.log\n!important.log"
iex> {:ok, patterns} = Dockerignore.parse(source)
iex> Enum.map(patterns, & &1.pattern)
["_build", "*.log", "important.log"]
iex> matcher = Dockerignore.compile!(source)
iex> Dockerignore.ignored?(matcher, "_build/app.beam")
true
iex> Dockerignore.ignored?(matcher, "important.log")
false
Summary
Functions
@spec compile(binary()) :: {:ok, Dockerignore.Matcher.t()} | {:error, Dockerignore.Error.t()}
@spec compile!(binary()) :: Dockerignore.Matcher.t()
@spec explain(Dockerignore.Matcher.t(), binary()) :: {:ignored, Dockerignore.Pattern.t()} | {:kept, Dockerignore.Pattern.t() | :no_match}
@spec filter(Dockerignore.Matcher.t(), Enumerable.t()) :: [binary()]
@spec ignored?(Dockerignore.Matcher.t(), binary()) :: boolean()
@spec parse(binary()) :: {:ok, [Dockerignore.Pattern.t()]} | {:error, Dockerignore.Error.t()}
@spec parse!(binary()) :: [Dockerignore.Pattern.t()]