@bemoje/cli 3.1.0 → 3.1.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/lib/index.cjs +7632 -58
- package/lib/index.js +7623 -8
- package/lib/lib/Command.cjs +7225 -49
- package/lib/lib/Command.js +7203 -26
- package/lib/lib/Help.cjs +4660 -11
- package/lib/lib/Help.js +4654 -4
- package/lib/lib/helpers/findCommand.cjs +9 -3
- package/lib/lib/helpers/findCommand.js +9 -2
- package/lib/lib/helpers/findOption.cjs +2 -0
- package/lib/lib/helpers/findOption.js +3 -1
- package/lib/lib/helpers/getCommandAncestors.cjs +14 -3
- package/lib/lib/helpers/getCommandAncestors.js +14 -2
- package/lib/lib/helpers/getCommandAndAncestors.cjs +2 -0
- package/lib/lib/helpers/getCommandAndAncestors.js +3 -1
- package/lib/lib/helpers/parseOptionFlags.cjs +2 -0
- package/lib/lib/helpers/parseOptionFlags.js +3 -1
- package/package.json +1 -1
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var object = require('@mono/object');
|
|
4
|
-
|
|
5
3
|
var __defProp = Object.defineProperty;
|
|
6
4
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
|
|
6
|
+
// ../object/src/valuesOf.ts
|
|
7
|
+
function valuesOf(obj) {
|
|
8
|
+
return Object.values(obj);
|
|
9
|
+
}
|
|
10
|
+
__name(valuesOf, "valuesOf");
|
|
11
|
+
|
|
12
|
+
// src/lib/helpers/findCommand.ts
|
|
7
13
|
function findCommand(cmd, nameOrAlias) {
|
|
8
|
-
return cmd.commands[nameOrAlias] ??
|
|
14
|
+
return cmd.commands[nameOrAlias] ?? valuesOf(cmd.commands).find((c) => {
|
|
9
15
|
return c.aliases.includes(nameOrAlias);
|
|
10
16
|
});
|
|
11
17
|
}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
|
+
// ../object/src/valuesOf.ts
|
|
5
|
+
function valuesOf(obj) {
|
|
6
|
+
return Object.values(obj);
|
|
7
|
+
}
|
|
8
|
+
__name(valuesOf, "valuesOf");
|
|
9
|
+
|
|
10
|
+
// src/lib/helpers/findCommand.ts
|
|
4
11
|
function findCommand(cmd, nameOrAlias) {
|
|
5
12
|
return cmd.commands[nameOrAlias] ?? valuesOf(cmd.commands).find((c) => {
|
|
6
13
|
return c.aliases.includes(nameOrAlias);
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
|
|
6
|
+
// src/lib/helpers/findOption.ts
|
|
5
7
|
function findOption(cmd, nameOrShortOrLong) {
|
|
6
8
|
return nameOrShortOrLong.startsWith("--") ? cmd.options.find((o) => {
|
|
7
9
|
return o.long === nameOrShortOrLong.slice(2);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
2
3
|
|
|
4
|
+
// src/lib/helpers/findOption.ts
|
|
3
5
|
function findOption(cmd, nameOrShortOrLong) {
|
|
4
6
|
return nameOrShortOrLong.startsWith("--") ? cmd.options.find((o) => {
|
|
5
7
|
return o.long === nameOrShortOrLong.slice(2);
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var getCommandAndAncestors = require('./getCommandAndAncestors');
|
|
4
|
-
|
|
5
3
|
var __defProp = Object.defineProperty;
|
|
6
4
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
|
|
6
|
+
// src/lib/helpers/getCommandAndAncestors.ts
|
|
7
|
+
function getCommandAndAncestors(cmd) {
|
|
8
|
+
const result = [];
|
|
9
|
+
let command = cmd;
|
|
10
|
+
for (; command; command = command.parent) {
|
|
11
|
+
result.push(command);
|
|
12
|
+
}
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
__name(getCommandAndAncestors, "getCommandAndAncestors");
|
|
16
|
+
|
|
17
|
+
// src/lib/helpers/getCommandAncestors.ts
|
|
7
18
|
function getCommandAncestors(cmd) {
|
|
8
|
-
return getCommandAndAncestors
|
|
19
|
+
return getCommandAndAncestors(cmd).slice(1);
|
|
9
20
|
}
|
|
10
21
|
__name(getCommandAncestors, "getCommandAncestors");
|
|
11
22
|
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
|
+
// src/lib/helpers/getCommandAndAncestors.ts
|
|
5
|
+
function getCommandAndAncestors(cmd) {
|
|
6
|
+
const result = [];
|
|
7
|
+
let command = cmd;
|
|
8
|
+
for (; command; command = command.parent) {
|
|
9
|
+
result.push(command);
|
|
10
|
+
}
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
__name(getCommandAndAncestors, "getCommandAndAncestors");
|
|
14
|
+
|
|
15
|
+
// src/lib/helpers/getCommandAncestors.ts
|
|
4
16
|
function getCommandAncestors(cmd) {
|
|
5
17
|
return getCommandAndAncestors(cmd).slice(1);
|
|
6
18
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
2
3
|
|
|
4
|
+
// src/lib/helpers/getCommandAndAncestors.ts
|
|
3
5
|
function getCommandAndAncestors(cmd) {
|
|
4
6
|
const result = [];
|
|
5
7
|
let command = cmd;
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
|
|
6
|
+
// src/lib/helpers/parseOptionFlags.ts
|
|
5
7
|
function parseOptionFlags(flags) {
|
|
6
8
|
const match = flags.match(/^-(.+?), --([A-Za-z][\w-]*)(?:\s*(<(.+?)>|\[(.+?)]))?$/);
|
|
7
9
|
if (!match) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
2
3
|
|
|
4
|
+
// src/lib/helpers/parseOptionFlags.ts
|
|
3
5
|
function parseOptionFlags(flags) {
|
|
4
6
|
const match = flags.match(/^-(.+?), --([A-Za-z][\w-]*)(?:\s*(<(.+?)>|\[(.+?)]))?$/);
|
|
5
7
|
if (!match) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bemoje/cli",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "A type-safe CLI framework for building command-line interfaces with typed arguments, options, subcommands, and auto-generated help - without execution coupling.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|