@hawkeyexl/manni 2.3.9 → 2.4.0
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 +1 -1
- package/dist/{chunk-LC4H35XX.js → chunk-LYLNOJ32.js} +3 -2
- package/dist/{chunk-LC4H35XX.js.map → chunk-LYLNOJ32.js.map} +1 -1
- package/dist/{chunk-YSI2VNKE.js → chunk-P4KR3XFD.js} +442 -57
- package/dist/chunk-P4KR3XFD.js.map +1 -0
- package/dist/{chunk-HOLRWVCO.js → chunk-Z2PBY6LN.js} +2 -2
- package/dist/cli.js +90 -4
- package/dist/cli.js.map +1 -1
- package/dist/docmeta.js +2 -2
- package/dist/index.d.ts +155 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-YSI2VNKE.js.map +0 -1
- /package/dist/{chunk-HOLRWVCO.js.map → chunk-Z2PBY6LN.js.map} +0 -0
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
supportedExtensions,
|
|
62
62
|
terminalConfirm,
|
|
63
63
|
toJsonText
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-LYLNOJ32.js";
|
|
65
65
|
|
|
66
66
|
// src/meta/cli.ts
|
|
67
67
|
import { existsSync } from "node:fs";
|
|
@@ -1517,4 +1517,4 @@ export {
|
|
|
1517
1517
|
reportConfig,
|
|
1518
1518
|
buildProgram
|
|
1519
1519
|
};
|
|
1520
|
-
//# sourceMappingURL=chunk-
|
|
1520
|
+
//# sourceMappingURL=chunk-Z2PBY6LN.js.map
|
package/dist/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
readStdin,
|
|
8
8
|
reportConfig,
|
|
9
9
|
splitList
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-Z2PBY6LN.js";
|
|
11
11
|
import {
|
|
12
12
|
CiteError,
|
|
13
13
|
KeyError,
|
|
@@ -25,18 +25,22 @@ import {
|
|
|
25
25
|
renderCheckGithub,
|
|
26
26
|
renderCheckJson,
|
|
27
27
|
renderCheckPretty,
|
|
28
|
+
renderRemoveJson,
|
|
29
|
+
renderRemovePretty,
|
|
28
30
|
renderUpdateJson,
|
|
29
31
|
renderUpdatePretty,
|
|
30
32
|
runAdd,
|
|
31
33
|
runCheck,
|
|
32
34
|
runKeyRotate,
|
|
33
35
|
runKeySet,
|
|
36
|
+
runRemove,
|
|
34
37
|
runUpdate,
|
|
35
38
|
shortCommit,
|
|
39
|
+
shortLine,
|
|
36
40
|
shortPin,
|
|
37
41
|
shortSrc,
|
|
38
42
|
spellSource
|
|
39
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-P4KR3XFD.js";
|
|
40
44
|
import {
|
|
41
45
|
COMMON_FORMAT_LIST,
|
|
42
46
|
OMITTED_WHEN_CLEAN,
|
|
@@ -74,7 +78,7 @@ import {
|
|
|
74
78
|
splitPageArgument,
|
|
75
79
|
terminalConfirm,
|
|
76
80
|
valeConfigPath
|
|
77
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-LYLNOJ32.js";
|
|
78
82
|
|
|
79
83
|
// src/cli.ts
|
|
80
84
|
import { Command as Command5 } from "commander";
|
|
@@ -1056,6 +1060,7 @@ function renderCheckJunit(run) {
|
|
|
1056
1060
|
|
|
1057
1061
|
// src/cite/cli.ts
|
|
1058
1062
|
var UPDATE_FORMATS = ["pretty", "json"];
|
|
1063
|
+
var REMOVE_FORMATS = UPDATE_FORMATS;
|
|
1059
1064
|
function colorFor(command, isTTY, env) {
|
|
1060
1065
|
const noColor = colorOwner(command).opts().color === false;
|
|
1061
1066
|
return shouldColor({ noColor, isTTY, env });
|
|
@@ -1069,6 +1074,9 @@ function colorOwner(command) {
|
|
|
1069
1074
|
function isUpdateFormat(value) {
|
|
1070
1075
|
return UPDATE_FORMATS.includes(value);
|
|
1071
1076
|
}
|
|
1077
|
+
function isRemoveFormat(value) {
|
|
1078
|
+
return REMOVE_FORMATS.includes(value);
|
|
1079
|
+
}
|
|
1072
1080
|
function splitPageArgument2(arg) {
|
|
1073
1081
|
return asCiteError(() => splitPageArgument(arg));
|
|
1074
1082
|
}
|
|
@@ -1081,7 +1089,9 @@ function addMessage(result) {
|
|
|
1081
1089
|
const name = citation.id ?? (claim === void 0 ? "a bare pin" : "an entry");
|
|
1082
1090
|
const src = shortSrc(spellSource(citation.source));
|
|
1083
1091
|
const commit = citation.source["commit-sha"];
|
|
1084
|
-
const
|
|
1092
|
+
const quoted = result.sourceLine === void 0 ? "" : shortLine(result.sourceLine);
|
|
1093
|
+
const line = quoted === "" ? "" : ` "${quoted}"`;
|
|
1094
|
+
const pin = `${src}${line}, ${shortPin(citation.source.integrity)}, ${commit === void 0 ? "no commit" : shortCommit(commit)}`;
|
|
1085
1095
|
const where2 = result.manifest === void 0 ? "frontmatter" : `${result.manifest.file}:${String(result.manifest.line)}`;
|
|
1086
1096
|
const head = `${result.file}: added ${name} to ${where2}`;
|
|
1087
1097
|
if (result.markerLine !== void 0) {
|
|
@@ -1355,6 +1365,82 @@ function buildProgram3() {
|
|
|
1355
1365
|
fail(err);
|
|
1356
1366
|
}
|
|
1357
1367
|
});
|
|
1368
|
+
program.command("remove").description("Remove the named citations from the given pages, markers and all").argument(
|
|
1369
|
+
"[paths...]",
|
|
1370
|
+
"files, directories, or globs to remove from (use - for stdin)"
|
|
1371
|
+
).option(
|
|
1372
|
+
"--collection <name>",
|
|
1373
|
+
"configured collection to run over; repeatable",
|
|
1374
|
+
collect,
|
|
1375
|
+
[]
|
|
1376
|
+
).option("--ext <list>", "comma-separated extensions for directory walks").option("--exclude <glob>", "glob to exclude; repeatable", collect, []).option("--as <format>", "force an input format for every input").option("-c, --config <path>", "path to a manni config file").option("--no-config", "ignore any discovered config file").option("--allow-empty", "treat zero matched files as success").option("--no-gitignore", "remove from files .gitignore covers").option(
|
|
1377
|
+
"--only <id>",
|
|
1378
|
+
"the entry to remove, by id or by pointer (/citations/N); required, and repeatable",
|
|
1379
|
+
collect,
|
|
1380
|
+
[]
|
|
1381
|
+
).option("--dry-run", "print the diffs and the report; write nothing").option(
|
|
1382
|
+
"-f, --format <format>",
|
|
1383
|
+
`output: ${REMOVE_FORMATS.join(" | ")}`,
|
|
1384
|
+
"pretty"
|
|
1385
|
+
).addHelpText(
|
|
1386
|
+
"after",
|
|
1387
|
+
[
|
|
1388
|
+
"",
|
|
1389
|
+
"Examples:",
|
|
1390
|
+
" manni cite remove docs/limits.md --only fetch-timeout",
|
|
1391
|
+
" manni cite remove docs/ --only fetch-timeout --only retries --dry-run",
|
|
1392
|
+
" manni cite remove --collection site --only /citations/3 -f json"
|
|
1393
|
+
].join("\n")
|
|
1394
|
+
).action(async (paths, options, command) => {
|
|
1395
|
+
try {
|
|
1396
|
+
const format = options.format;
|
|
1397
|
+
if (!isRemoveFormat(format)) {
|
|
1398
|
+
throw new CiteError(
|
|
1399
|
+
`Unknown --format "${format}". Use ${COMMON_FORMAT_LIST}.`
|
|
1400
|
+
);
|
|
1401
|
+
}
|
|
1402
|
+
const exts = options.ext ? splitList(options.ext) : void 0;
|
|
1403
|
+
const usingStdin = paths.includes(STDIN_TOKEN);
|
|
1404
|
+
const stdinContent = usingStdin ? await readStdin() : void 0;
|
|
1405
|
+
const dryRun = Boolean(options.dryRun);
|
|
1406
|
+
const pageToStdout = usingStdin && !dryRun;
|
|
1407
|
+
const cwd = process.cwd();
|
|
1408
|
+
const run = await runRemove({
|
|
1409
|
+
inputs: paths,
|
|
1410
|
+
collection: options.collection,
|
|
1411
|
+
exts,
|
|
1412
|
+
exclude: options.exclude,
|
|
1413
|
+
as: options.as,
|
|
1414
|
+
...configOption(options.config),
|
|
1415
|
+
onConfigLoaded: reportConfig(format === "pretty" && !pageToStdout, cwd),
|
|
1416
|
+
stdinContent,
|
|
1417
|
+
allowEmpty: options.allowEmpty ? true : void 0,
|
|
1418
|
+
respectGitignore: explicitFalse(options.gitignore),
|
|
1419
|
+
onNotice: notice,
|
|
1420
|
+
only: options.only,
|
|
1421
|
+
dryRun
|
|
1422
|
+
});
|
|
1423
|
+
const text2 = format === "json" ? renderRemoveJson(run) : renderRemovePretty(run, {
|
|
1424
|
+
color: colorFor(command, process.stdout.isTTY),
|
|
1425
|
+
// The diffs are the point of a dry run; a real run prints
|
|
1426
|
+
// what it removed and leaves the file to say the rest.
|
|
1427
|
+
showDiff: dryRun,
|
|
1428
|
+
dryRun
|
|
1429
|
+
});
|
|
1430
|
+
const stdinPage = pageToStdout ? run.pages.find((page) => page.content !== void 0) : void 0;
|
|
1431
|
+
if (stdinPage?.content !== void 0) {
|
|
1432
|
+
process.stdout.write(stdinPage.content);
|
|
1433
|
+
process.stderr.write(`${text2}
|
|
1434
|
+
`);
|
|
1435
|
+
} else {
|
|
1436
|
+
process.stdout.write(`${text2}
|
|
1437
|
+
`);
|
|
1438
|
+
}
|
|
1439
|
+
process.exitCode = 0;
|
|
1440
|
+
} catch (err) {
|
|
1441
|
+
fail(err);
|
|
1442
|
+
}
|
|
1443
|
+
});
|
|
1358
1444
|
return program;
|
|
1359
1445
|
}
|
|
1360
1446
|
|