diff options
author | Leah Neukirchen <leah@vuxu.org> | 2017-11-08 16:27:55 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2017-11-08 16:27:55 +0100 |
commit | edf84d21a185598cee59132e34fdf33bc71df6b3 (patch) | |
tree | 1f0adcaff1e387a0412f22135197349b49c2f352 | |
parent | 7f683af905ca5ee6d332dd0954383e8bf7d52b3c (diff) | |
download | lr-edf84d21a185598cee59132e34fdf33bc71df6b3.tar.gz lr-edf84d21a185598cee59132e34fdf33bc71df6b3.tar.xz lr-edf84d21a185598cee59132e34fdf33bc71df6b3.zip |
make prune evaluate to false
-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: |