@henderea/arg-helper 1.2.6 → 1.2.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/package.json +13 -16
- package/src/index.d.ts +1 -1
- package/src/index.js +6 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@henderea/arg-helper",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"description": "A utility wrapper around the arg command-line parser",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -12,26 +12,23 @@
|
|
|
12
12
|
"lint:fix": "eslint --fix src"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"arg": "5.
|
|
15
|
+
"arg": "^5.0.2"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"escalade": "^3.1.
|
|
18
|
+
"escalade": "^3.1.2"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@
|
|
22
|
-
"@typescript-eslint/
|
|
23
|
-
"eslint": "^8.
|
|
24
|
-
"eslint
|
|
25
|
-
"eslint-
|
|
26
|
-
"
|
|
21
|
+
"@stylistic/eslint-plugin": "^5.9.0",
|
|
22
|
+
"@typescript-eslint/eslint-plugin": "^8.56.1",
|
|
23
|
+
"@typescript-eslint/parser": "^8.56.1",
|
|
24
|
+
"eslint": "^9.39.3",
|
|
25
|
+
"eslint-config-henderea": "^2.0.113",
|
|
26
|
+
"eslint-plugin-import": "^2.32.0",
|
|
27
|
+
"globals": "^17.4.0",
|
|
28
|
+
"typescript": "^5.9.3",
|
|
29
|
+
"typescript-eslint": "^8.56.1"
|
|
27
30
|
},
|
|
28
31
|
"files": [
|
|
29
32
|
"src/**/*"
|
|
30
|
-
]
|
|
31
|
-
"eslintConfig": {
|
|
32
|
-
"extends": "henderea",
|
|
33
|
-
"rules": {
|
|
34
|
-
"@typescript-eslint/ban-types": 0
|
|
35
|
-
}
|
|
36
|
-
}
|
|
33
|
+
]
|
|
37
34
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ declare namespace argHelper {
|
|
|
15
15
|
number(name: string, ...names: Array<string>): this;
|
|
16
16
|
numbers(name: string, ...names: Array<string>): this;
|
|
17
17
|
count(name: string, ...names: Array<string>): this;
|
|
18
|
-
|
|
18
|
+
help(helpText: string, ...names: Array<string>): this;
|
|
19
19
|
findVersion(callerPath: string, ...names: Array<string>): this;
|
|
20
20
|
version(packageJsonFile: string, ...names: Array<string>): this;
|
|
21
21
|
withVersion(version: string, ...names: Array<string>): this;
|
package/src/index.js
CHANGED
|
@@ -12,8 +12,8 @@ class ArgParser {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
flag(name, ...names) {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
const type = names.pop();
|
|
16
|
+
const mainName = names.shift();
|
|
17
17
|
this._opts[mainName] = type;
|
|
18
18
|
this._names[mainName] = name;
|
|
19
19
|
if(names.length > 0) {
|
|
@@ -24,7 +24,7 @@ class ArgParser {
|
|
|
24
24
|
return this;
|
|
25
25
|
}
|
|
26
26
|
flags(name, ...names) {
|
|
27
|
-
|
|
27
|
+
const type = names.pop();
|
|
28
28
|
return this.flag(name, ...names, [type]);
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -56,10 +56,10 @@ class ArgParser {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
parse(argv = null) {
|
|
59
|
-
|
|
59
|
+
const config = { permissive: true };
|
|
60
60
|
if(argv !== null) { config.argv = argv; }
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
const options = this._arg(this._opts, config);
|
|
62
|
+
const rv = {};
|
|
63
63
|
Object.keys(options).forEach((k) => {
|
|
64
64
|
rv[k] = options[k];
|
|
65
65
|
if(Object.prototype.hasOwnProperty.call(this._names, k)) {
|