From 1d3f2d1e4c59867024470d3444e12698b7ebb22e Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Mon, 14 Sep 2026 14:08:36 +0200 Subject: 0.0.4: max-size, exclude forms, --min-age --- docs/design.md | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'docs/design.md') diff --git a/docs/design.md b/docs/design.md index 437b602..3130870 100644 --- a/docs/design.md +++ b/docs/design.md @@ -3,7 +3,9 @@ Status: describes krino 0.0.1, 2026-09-13; amended 2026-09-14 for 0.0.2: duplicates are never deleted (§5.5), and coloured output with `--no-color` (§8.2, §11); amended again 2026-09-14 for 0.0.3: the plan -shown as one block per file, wrapped to the terminal, and `-P` (§8.2, §8.3, §11). +shown as one block per file, wrapped to the terminal, and `-P` (§8.2, §8.3, §11); +amended again 2026-09-14 for 0.0.4: `max-size` (§4.4), `(exclude ...)` +(§4.2, §4.3, §4.6) and `--min-age` (§11). krino (from Greek κρίνω, "to separate, to judge, to decide") sorts files in chosen directories by rules. A rule tests a file's type, name, path, size, @@ -100,6 +102,7 @@ type names, operators, sizes and durations are symbols. (log "~/.local/state/krino/krino.log") ; optional (defaults ; optional; any setting from 4.4 (min-age 5m)) +(exclude (type iso)) ; optional, may repeat; every directory (4.6) ``` ### 4.3 `dirs/.conf` @@ -108,6 +111,7 @@ type names, operators, sizes and durations are symbols. (path "~/downloads") ; required (recursive no) ; any setting from 4.4 (ignore "*.part" "*.aria2" ".*") ; may repeat; patterns accumulate in order +(exclude (name "^keep-")) ; may repeat; this directory only (4.6) (rule "acme" (when (type document) @@ -135,6 +139,7 @@ directory, then defaults, then built-in. | `max-depth` | integer, 1 = root only | unlimited | | | `min-age` | duration. Skip files modified more recently | `2m` | | | `max-read` | size. No content extraction above this file size | `50M` | | +| `max-size` | size. Skip files larger than this, as "too big" | unlimited | | | `busy` | suffixes. Skip `f` when `f` exists beside it | `".part" ".aria2" ".crdownload"` | | | `on-conflict` | `suffix` \| `skip` \| `overwrite` (§7.4) | `suffix` | yes | @@ -171,6 +176,27 @@ A rule whose condition contains `(duplicate)` anywhere, including inside absolute paths are allowed. It is created if missing. `DEST` and `NAME` take placeholders (§7.3). +### 4.6 Exclusions + +```lisp +(exclude (type iso img)) ; by extension +(exclude (name "^keep-")) ; by name +(exclude (type pdf) (content "confidential")) ; by content +``` + +`(exclude COND...)` sets files aside before any rule sees them. Its +conditions are the tests of §5.2, and all of them must hold, as in `when`; +a file matching any `exclude` form is excluded. Forms in `krino.conf` apply +to every directory and are tested first, then the directory's own. They are +compiled with the directory's `case` and `fold`. An excluded file is counted +as "excluded" in the plan, listed with the form that matched under `-v`, +and traced by `explain`; `check` lists every directory's exclusions. Since +no rule has run yet, `(matched)` is never true inside an exclude. + +Unlike `ignore`, which never looks inside a file and never descends into an +ignored directory, an exclude can test content and size, and is evaluated +per file after the walk. + ## 5. Conditions ### 5.1 Operators @@ -399,7 +425,8 @@ name has to change, the log records the actual name. excluded before the walk, and krino would re-examine its own output; plan 3 closes this by treating a file already at its computed destination as a no-op. -- Skipped as busy: files newer than `min-age`, or with a `busy` sibling. +- Skipped: files newer than `min-age` ("too new"), larger than `max-size` + ("too big"), or with a `busy` sibling ("busy"). ### 8.2 Display @@ -580,6 +607,7 @@ krino undo [RUN] reverse a run (default: the last one) -c FILE use FILE instead of ~/.config/krino/krino.conf --no-color never colour the output, as when NO_COLOR is set -P, --no-pager print the plan straight out, never through the pager +--min-age D for this run, every directory's min-age is D (0, 30s, 1d) -h, --help help --version print "krino 0.0.1" ``` -- cgit v1.3