diff options
-rw-r--r-- | NEWS.md | 3 | ||||
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | lr.c | 2 |
3 files changed, 10 insertions, 1 deletions
diff --git a/NEWS.md b/NEWS.md index 5dd0ffe..878062a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ ## HEAD +* **Breaking change**: `prune` now evaluates to a false value. + The common find(1) idiom is now best written as `name = "x" ? prune : print`. + * Feature: new option `-B` for breadth first traversal. * Feature: new syntax `? :` for ternary operator. diff --git a/README.md b/README.md index 8d59713..eb21a3c 100644 --- a/README.md +++ b/README.md @@ -304,6 +304,12 @@ List all files, but print them in red if they match "havoc": % lr -G -t 'name =~ "havoc" && color 160 || print' ``` +Do not enter `.git` or `.hg` directories: + +``` +% lr -t 'name = ".git" || name = ".hg" ? prune : print' . +``` + ## Installation Use `make all` to build, `make install` to install relative to `PREFIX` diff --git a/lr.c b/lr.c index f9c1ca5..fe2d91b 100644 --- a/lr.c +++ b/lr.c @@ -1227,7 +1227,7 @@ eval(struct expr *e, struct fileinfo *fi) return !eval(e->a.expr, fi); case EXPR_PRUNE: prune = 1; - return 1; + return 0; case EXPR_PRINT: return 1; case EXPR_COLOR: |