dir-analysis-tool 3.5.6 → 3.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/cli.js +17 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -302,11 +302,11 @@ dat watch . -j -o report.json # keep report.json up to date
|
|
|
302
302
|
- **A missing root.** A directory that doesn't exist (or isn't a directory) when `watch` starts is an error: one message, exit code `1`. If the watched directory is deleted later, `watch` says so once and waits; when it comes back, it reports again and resumes watching, on every platform and with `--poll`.
|
|
303
303
|
- **Stopping.** Ctrl+C stops `watch` with exit code `130`, as for every command. It also stops on its own, with exit code `0`, when the reader of its output goes away (`dat watch --json | head -1`).
|
|
304
304
|
|
|
305
|
-
| Option | Description
|
|
306
|
-
| ------------------ |
|
|
307
|
-
| `--debounce <ms>` | Wait this long after the last change. Default `300`.
|
|
308
|
-
| `--poll <seconds>` | Re-scan
|
|
309
|
-
| `--no-clear` | Keep earlier reports instead of clearing the screen.
|
|
305
|
+
| Option | Description |
|
|
306
|
+
| ------------------ | -------------------------------------------------------------------------------------------------------------------- |
|
|
307
|
+
| `--debounce <ms>` | Wait this long after the last change. Default `300`. |
|
|
308
|
+
| `--poll <seconds>` | Re-scan this many seconds after each scan ends, instead of using filesystem events, so scans never run back to back. |
|
|
309
|
+
| `--no-clear` | Keep earlier reports instead of clearing the screen. |
|
|
310
310
|
|
|
311
311
|
All scan, report, and output options are accepted too (`pretty` and `json` formats).
|
|
312
312
|
|
package/dist/cli.js
CHANGED
|
@@ -1449,7 +1449,7 @@ function registerWatch(program, ctx) {
|
|
|
1449
1449
|
addScanOptions(command);
|
|
1450
1450
|
addReportOptions(command);
|
|
1451
1451
|
addOutputOptions(command, ["pretty", "json"]);
|
|
1452
|
-
command.addOption(new Option("--debounce <ms>", "wait this long after the last change (default: 300)").argParser(integer(0)).helpGroup("Watch options:")).addOption(new Option("--poll <seconds>", "re-scan
|
|
1452
|
+
command.addOption(new Option("--debounce <ms>", "wait this long after the last change (default: 300)").argParser(integer(0)).helpGroup("Watch options:")).addOption(new Option("--poll <seconds>", "re-scan this many seconds after each scan ends, instead of using filesystem events").argParser(integer(1)).helpGroup("Watch options:")).addOption(new Option("--no-clear", "keep previous reports instead of clearing the screen").helpGroup("Watch options:"));
|
|
1453
1453
|
command.addHelpText("after", EXAMPLES);
|
|
1454
1454
|
command.action(async (directory, _options, cmd) => {
|
|
1455
1455
|
const cli = explicitOptions(cmd);
|
|
@@ -1502,6 +1502,9 @@ function registerWatch(program, ctx) {
|
|
|
1502
1502
|
const readerGone = () => ctx.stdoutClosed;
|
|
1503
1503
|
let watcher = null;
|
|
1504
1504
|
let poller = null;
|
|
1505
|
+
let finished = false;
|
|
1506
|
+
/** The run in progress, so a poll can wait for it before counting its idle time. */
|
|
1507
|
+
let active = Promise.resolve();
|
|
1505
1508
|
const closeWatcher = () => {
|
|
1506
1509
|
watcher?.close();
|
|
1507
1510
|
watcher = null;
|
|
@@ -1515,7 +1518,11 @@ function registerWatch(program, ctx) {
|
|
|
1515
1518
|
polling = true;
|
|
1516
1519
|
if (rootCheck) clearInterval(rootCheck);
|
|
1517
1520
|
rootCheck = null;
|
|
1518
|
-
|
|
1521
|
+
const tick = async () => {
|
|
1522
|
+
await run();
|
|
1523
|
+
if (!finished && !signal?.aborted) poller = setTimeout(() => void tick(), seconds * 1e3);
|
|
1524
|
+
};
|
|
1525
|
+
poller = setTimeout(() => void tick(), seconds * 1e3);
|
|
1519
1526
|
};
|
|
1520
1527
|
const markRootGone = () => {
|
|
1521
1528
|
if (rootGone) return;
|
|
@@ -1577,11 +1584,15 @@ function registerWatch(program, ctx) {
|
|
|
1577
1584
|
throw error;
|
|
1578
1585
|
}
|
|
1579
1586
|
};
|
|
1580
|
-
const run =
|
|
1587
|
+
const run = (initial = false) => {
|
|
1581
1588
|
if (running) {
|
|
1582
1589
|
pending = true;
|
|
1583
|
-
return;
|
|
1590
|
+
return active;
|
|
1584
1591
|
}
|
|
1592
|
+
active = runLoop(initial);
|
|
1593
|
+
return active;
|
|
1594
|
+
};
|
|
1595
|
+
const runLoop = async (initial) => {
|
|
1585
1596
|
running = true;
|
|
1586
1597
|
try {
|
|
1587
1598
|
for (;;) {
|
|
@@ -1627,7 +1638,8 @@ function registerWatch(program, ctx) {
|
|
|
1627
1638
|
})]);
|
|
1628
1639
|
}
|
|
1629
1640
|
if (timer) clearTimeout(timer);
|
|
1630
|
-
|
|
1641
|
+
finished = true;
|
|
1642
|
+
if (poller) clearTimeout(poller);
|
|
1631
1643
|
if (rootCheck) clearInterval(rootCheck);
|
|
1632
1644
|
closeWatcher();
|
|
1633
1645
|
if (signal?.aborted) throw new AbortError();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dir-analysis-tool",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.7",
|
|
4
4
|
"description": "Fast, zero-dependency directory analysis for your terminal and CI: largest folders and files, type and extension breakdowns, staged duplicate detection, size budgets, directory diffs, and self-contained HTML, Markdown, JSON, and CSV reports.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|