From 647d0821b590ee96056f4593640534542d8700e5 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Wed, 10 Jun 2020 09:30:29 +0200 Subject: [PATCH] README.md: Add gitignoreFilter to Usage --- README.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1152df4..59947a9 100644 --- a/README.md +++ b/README.md @@ -41,8 +41,25 @@ mkDerivation { } ``` -You can use Nixpkgs' [`cleanSourceWith`](https://github.com/NixOS/nixpkgs/blob/d1bb36d5cb5b78111f799eb26f5f17e5979bc746/lib/sources.nix#L35-L67) to compose with other filters (by logical _and_) or to set a `name`. -If you need something more exotic, you may want to use [gitignoreFilter](docs/gitignoreFilter.md) directly. +``` +gitignoreSource :: path -> path +``` + +Returns result of cleanSourceWith, usable as a path but also composable. + +``` +gitignoreFilter :: path -> (path -> type -> bool) + +f = gitignoreFilter path +``` + +Parentheses in the type emphasize that a partial application memoizes the git metadata. You can use Nixpkgs' [`cleanSourceWith`](https://github.com/NixOS/nixpkgs/blob/d1bb36d5cb5b78111f799eb26f5f17e5979bc746/lib/sources.nix#L35-L67) to compose with other filters (by logical _and_) or to set a `name`. + +`path`: a path being the root or a subdirectory of a local git repository + +`f`: a function that returns `false` for files that should be ignored according to gitignore rules, but only for paths at or below `path`. + +See [gitignoreFilter](docs/gitignoreFilter.md) for an example. # Features