mdat-plugin-cli-help 3.0.0 → 3.0.1
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/dist/index.d.ts +6 -5
- package/dist/index.js +18 -11
- package/package.json +12 -18
- package/readme.md +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import * as _$mdat from "mdat";
|
|
2
1
|
import { ILogBasic, ILogLayer } from "lognow";
|
|
3
2
|
|
|
4
3
|
//#region src/utilities/log.d.ts
|
|
5
4
|
/**
|
|
6
|
-
* Set the logger instance for the module.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Set the logger instance for the module. Export this for library consumers to
|
|
6
|
+
* inject their own logger.
|
|
7
|
+
*
|
|
8
|
+
* @param logger - Accepts either a LogLayer instance or a Console- or
|
|
9
|
+
* Stream-like log target
|
|
9
10
|
*/
|
|
10
11
|
declare function setLogger(logger?: ILogBasic | ILogLayer<unknown>): void;
|
|
11
12
|
//#endregion
|
|
12
13
|
//#region src/index.d.ts
|
|
13
|
-
declare const _default:
|
|
14
|
+
declare const _default: import("mdat").Config;
|
|
14
15
|
//#endregion
|
|
15
16
|
export { _default as default, setLogger };
|
package/dist/index.js
CHANGED
|
@@ -126,9 +126,11 @@ let log = createLogger({
|
|
|
126
126
|
name: "mdat-plugin-cli-help"
|
|
127
127
|
});
|
|
128
128
|
/**
|
|
129
|
-
* Set the logger instance for the module.
|
|
130
|
-
*
|
|
131
|
-
*
|
|
129
|
+
* Set the logger instance for the module. Export this for library consumers to
|
|
130
|
+
* inject their own logger.
|
|
131
|
+
*
|
|
132
|
+
* @param logger - Accepts either a LogLayer instance or a Console- or
|
|
133
|
+
* Stream-like log target
|
|
132
134
|
*/
|
|
133
135
|
function setLogger(logger) {
|
|
134
136
|
log = injectionHelper(logger);
|
|
@@ -379,7 +381,8 @@ var CliHelpToObjectVisitor$2 = class extends parser$2.getBaseCstVisitorConstruct
|
|
|
379
381
|
};
|
|
380
382
|
}
|
|
381
383
|
/**
|
|
382
|
-
* Clean a Commander default value: strip `(default: ...)` wrapper, env info,
|
|
384
|
+
* Clean a Commander default value: strip `(default: ...)` wrapper, env info,
|
|
385
|
+
* and quotes.
|
|
383
386
|
*/
|
|
384
387
|
cleanDefault(text) {
|
|
385
388
|
if (text === void 0) return;
|
|
@@ -441,8 +444,8 @@ function helpStringToObject$3(helpString) {
|
|
|
441
444
|
* (typically 30+ spaces). The lexer's ROW_MODE exits on newline, so we must
|
|
442
445
|
* unwrap these before tokenizing.
|
|
443
446
|
*
|
|
444
|
-
* Detection: a continuation line has 4+ leading spaces and does NOT start a
|
|
445
|
-
*
|
|
447
|
+
* Detection: a continuation line has 4+ leading spaces and does NOT start a new
|
|
448
|
+
* row (which would be exactly 2 spaces + a non-space character).
|
|
446
449
|
*/
|
|
447
450
|
const continuationLinePattern = /^ {4,}/;
|
|
448
451
|
const newRowPattern = /^ {2}\S/;
|
|
@@ -1077,8 +1080,8 @@ function helpStringToObject(helpString) {
|
|
|
1077
1080
|
* @param helpFlag - The flag to pass to get help output
|
|
1078
1081
|
* @param depth - Max recursion depth for subcommands
|
|
1079
1082
|
* @param subcommands - Initial subcommand path to invoke before the help flag
|
|
1080
|
-
* (e.g. `['remote', 'add']` produces `command remote add --help`).
|
|
1081
|
-
*
|
|
1083
|
+
* (e.g. `['remote', 'add']` produces `command remote add --help`). Discovered
|
|
1084
|
+
* subcommands are appended to this path during recursion.
|
|
1082
1085
|
*/
|
|
1083
1086
|
async function getHelpMarkdown(command, helpFlag = "--help", depth, subcommands = []) {
|
|
1084
1087
|
return getHelpMarkdownInternal(command, subcommands, helpFlag, depth ?? Number.MAX_SAFE_INTEGER);
|
|
@@ -1134,8 +1137,9 @@ async function getHelpString(command, args) {
|
|
|
1134
1137
|
//#endregion
|
|
1135
1138
|
//#region src/utilities/is-executable.ts
|
|
1136
1139
|
/**
|
|
1137
|
-
* This file is vendored with modification from
|
|
1138
|
-
* to work around a "[DEP0176]
|
|
1140
|
+
* This file is vendored with modification from
|
|
1141
|
+
* https://github.com/sindresorhus/is-executable to work around a "[DEP0176]
|
|
1142
|
+
* DeprecationWarning: fs.X_OK is deprecated, use fs.constants.X_OK instead"
|
|
1139
1143
|
* error from Node.
|
|
1140
1144
|
*/
|
|
1141
1145
|
const isWindows = process.platform === "win32";
|
|
@@ -1155,7 +1159,10 @@ async function isExecutable(filePath, strictExtensions = false) {
|
|
|
1155
1159
|
//#region src/utilities/infer-command.ts
|
|
1156
1160
|
/**
|
|
1157
1161
|
* Accommodate missing or sloppy cli help command input
|
|
1158
|
-
*
|
|
1162
|
+
*
|
|
1163
|
+
* @param command - Can be nothing, a command name on the path like `git`, or a
|
|
1164
|
+
* path to an executable like `./bin/cli.js`
|
|
1165
|
+
*
|
|
1159
1166
|
* @returns The path to a verified executable
|
|
1160
1167
|
* @throws {Error} If nothing can be inferred or resolved
|
|
1161
1168
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mdat-plugin-cli-help",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Mdat plugin to generate tabular help documentation for CLI tools in Markdown files.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -38,36 +38,30 @@
|
|
|
38
38
|
"@types/which": "^3.0.4",
|
|
39
39
|
"chevrotain": "^12.0.0",
|
|
40
40
|
"execa": "^9.6.1",
|
|
41
|
-
"lognow": "^0.6.
|
|
41
|
+
"lognow": "^0.6.2",
|
|
42
42
|
"type-fest": "^5.6.0",
|
|
43
|
-
"which": "^
|
|
44
|
-
"zod": "^4.3
|
|
43
|
+
"which": "^7.0.0",
|
|
44
|
+
"zod": "^4.4.3"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@kitschpatrol/shared-config": "^7.
|
|
48
|
-
"@types/node": "~22.
|
|
47
|
+
"@kitschpatrol/shared-config": "^7.6.0",
|
|
48
|
+
"@types/node": "~22.19.19",
|
|
49
49
|
"@types/yargs": "^17.0.35",
|
|
50
|
-
"bumpp": "^11.0
|
|
50
|
+
"bumpp": "^11.1.0",
|
|
51
51
|
"commander": "^14.0.3",
|
|
52
|
-
"mdat": "^2.3.
|
|
52
|
+
"mdat": "^2.3.4",
|
|
53
53
|
"meow": "^14.1.0",
|
|
54
54
|
"shx": "^0.4.0",
|
|
55
|
-
"tsdown": "^0.
|
|
55
|
+
"tsdown": "^0.22.0",
|
|
56
56
|
"typescript": "~5.9.3",
|
|
57
|
-
"vitest": "^4.1.
|
|
57
|
+
"vitest": "^4.1.6",
|
|
58
58
|
"yargs": "^18.0.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"mdat": "^2.0.0"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
|
-
"node": ">=22.
|
|
65
|
-
},
|
|
66
|
-
"devEngines": {
|
|
67
|
-
"runtime": {
|
|
68
|
-
"name": "node",
|
|
69
|
-
"version": ">=22.21.0"
|
|
70
|
-
}
|
|
64
|
+
"node": ">=22.22.2"
|
|
71
65
|
},
|
|
72
66
|
"scripts": {
|
|
73
67
|
"bench": "vitest bench --run --no-file-parallelism --compare test/benchmarks/baseline.json",
|
|
@@ -76,7 +70,7 @@
|
|
|
76
70
|
"clean": "shx rm -f pnpm-lock.yaml && git clean -fdX -e !.claude/",
|
|
77
71
|
"fix": "ksc fix",
|
|
78
72
|
"lint": "ksc lint",
|
|
79
|
-
"release": "bumpp --commit 'Release: %s' && pnpm build && NPM_AUTH_TOKEN=$(op read 'op://Personal/npm/token')
|
|
73
|
+
"release": "bumpp --commit 'Release: %s' && pnpm build && NPM_AUTH_TOKEN=$(op read 'op://Personal/npm/token') pnpm publish",
|
|
80
74
|
"test": "vitest run --no-file-parallelism"
|
|
81
75
|
}
|
|
82
76
|
}
|
package/readme.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<!-- badges -->
|
|
8
8
|
|
|
9
9
|
[](https://npmjs.com/package/mdat-plugin-cli-help)
|
|
10
|
-
[](https://opensource.org/
|
|
10
|
+
[](https://opensource.org/license/mit/)
|
|
11
11
|
[](https://github.com/kitschpatrol/mdat-plugin-cli-help/actions/workflows/ci.yml)
|
|
12
12
|
|
|
13
13
|
<!-- /badges -->
|