@thi.ng/args 2.0.0 → 2.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/CHANGELOG.md +8 -0
- package/README.md +3 -2
- package/args.d.ts +1 -1
- package/args.js +1 -1
- package/coerce.d.ts +1 -1
- package/coerce.js +1 -1
- package/index.d.ts +5 -5
- package/index.js +5 -5
- package/package.json +10 -7
- package/parse.d.ts +1 -1
- package/parse.js +1 -1
- package/usage.d.ts +1 -1
- package/usage.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/args@2.0.0...@thi.ng/args@2.0.1) (2021-10-13)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @thi.ng/args
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/args@1.1.1...@thi.ng/args@2.0.0) (2021-10-12)
|
|
7
15
|
|
|
8
16
|
|
package/README.md
CHANGED
|
@@ -62,10 +62,11 @@ ES module import:
|
|
|
62
62
|
|
|
63
63
|
[Skypack documentation](https://docs.skypack.dev/)
|
|
64
64
|
|
|
65
|
-
For
|
|
65
|
+
For Node.js REPL:
|
|
66
66
|
|
|
67
67
|
```text
|
|
68
|
-
|
|
68
|
+
# with flag only for < v16
|
|
69
|
+
node --experimental-repl-await
|
|
69
70
|
|
|
70
71
|
> const args = await import("@thi.ng/args");
|
|
71
72
|
```
|
package/args.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Fn } from "@thi.ng/api";
|
|
2
|
-
import type { ArgSpec, KVDict, KVMultiDict, Tuple } from "./api";
|
|
2
|
+
import type { ArgSpec, KVDict, KVMultiDict, Tuple } from "./api.js";
|
|
3
3
|
/**
|
|
4
4
|
* Returns a full {@link ArgSpec} for a boolean flag. The mere presence of this
|
|
5
5
|
* arg will enable the flag.
|
package/args.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { repeat } from "@thi.ng/strings/repeat";
|
|
2
|
-
import { coerceFloat, coerceFloats, coerceHexInt, coerceHexInts, coerceInt, coerceInts, coerceJson, coerceKV, coerceOneOf, coerceTuple, } from "./coerce";
|
|
2
|
+
import { coerceFloat, coerceFloats, coerceHexInt, coerceHexInts, coerceInt, coerceInts, coerceJson, coerceKV, coerceOneOf, coerceTuple, } from "./coerce.js";
|
|
3
3
|
const $single = (coerce, hint) => (spec) => ({
|
|
4
4
|
coerce,
|
|
5
5
|
hint,
|
package/coerce.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Fn } from "@thi.ng/api";
|
|
2
|
-
import { KVDict, KVMultiDict, Tuple } from "./api";
|
|
2
|
+
import { KVDict, KVMultiDict, Tuple } from "./api.js";
|
|
3
3
|
export declare const coerceString: (x: string) => string;
|
|
4
4
|
export declare const coerceFloat: (x: string) => number;
|
|
5
5
|
export declare const coerceFloats: (xs: string[]) => number[];
|
package/coerce.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isHex } from "@thi.ng/checks/is-hex";
|
|
2
2
|
import { isNumericFloat, isNumericInt } from "@thi.ng/checks/is-numeric";
|
|
3
3
|
import { illegalArgs } from "@thi.ng/errors/illegal-arguments";
|
|
4
|
-
import { Tuple } from "./api";
|
|
4
|
+
import { Tuple } from "./api.js";
|
|
5
5
|
export const coerceString = (x) => x;
|
|
6
6
|
export const coerceFloat = (x) => isNumericFloat(x)
|
|
7
7
|
? parseFloat(x)
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from "./api";
|
|
2
|
-
export * from "./args";
|
|
3
|
-
export * from "./coerce";
|
|
4
|
-
export * from "./parse";
|
|
5
|
-
export * from "./usage";
|
|
1
|
+
export * from "./api.js";
|
|
2
|
+
export * from "./args.js";
|
|
3
|
+
export * from "./coerce.js";
|
|
4
|
+
export * from "./parse.js";
|
|
5
|
+
export * from "./usage.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./api";
|
|
2
|
-
export * from "./args";
|
|
3
|
-
export * from "./coerce";
|
|
4
|
-
export * from "./parse";
|
|
5
|
-
export * from "./usage";
|
|
1
|
+
export * from "./api.js";
|
|
2
|
+
export * from "./args.js";
|
|
3
|
+
export * from "./coerce.js";
|
|
4
|
+
export * from "./parse.js";
|
|
5
|
+
export * from "./usage.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/args",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Declarative, functional & typechecked CLI argument/options parser, value coercions etc.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.0.
|
|
38
|
-
"@thi.ng/checks": "^3.0.
|
|
39
|
-
"@thi.ng/errors": "^2.0.
|
|
40
|
-
"@thi.ng/strings": "^3.0.
|
|
37
|
+
"@thi.ng/api": "^8.0.1",
|
|
38
|
+
"@thi.ng/checks": "^3.0.1",
|
|
39
|
+
"@thi.ng/errors": "^2.0.1",
|
|
40
|
+
"@thi.ng/strings": "^3.0.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@thi.ng/testament": "^0.1.
|
|
43
|
+
"@thi.ng/testament": "^0.1.1"
|
|
44
44
|
},
|
|
45
45
|
"keywords": [
|
|
46
46
|
"argument",
|
|
@@ -61,6 +61,9 @@
|
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
|
+
"engines": {
|
|
65
|
+
"node": ">=12.7"
|
|
66
|
+
},
|
|
64
67
|
"files": [
|
|
65
68
|
"*.js",
|
|
66
69
|
"*.d.ts"
|
|
@@ -88,5 +91,5 @@
|
|
|
88
91
|
"thi.ng": {
|
|
89
92
|
"year": 2018
|
|
90
93
|
},
|
|
91
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "2e6b3d7c0f4c5686c1e9bdb4902ed7d3f90bcc19"
|
|
92
95
|
}
|
package/parse.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { IObjectOf } from "@thi.ng/api";
|
|
2
|
-
import type { Args, ParseOpts, ParseResult } from "./api";
|
|
2
|
+
import type { Args, ParseOpts, ParseResult } from "./api.js";
|
|
3
3
|
export declare const parse: <T extends IObjectOf<any>>(specs: Args<T>, argv: string[], opts?: Partial<ParseOpts> | undefined) => ParseResult<T> | undefined;
|
|
4
4
|
//# sourceMappingURL=parse.d.ts.map
|
package/parse.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isArray } from "@thi.ng/checks/is-array";
|
|
2
2
|
import { illegalArgs } from "@thi.ng/errors/illegal-arguments";
|
|
3
3
|
import { camel } from "@thi.ng/strings/case";
|
|
4
|
-
import { usage } from "./usage";
|
|
4
|
+
import { usage } from "./usage.js";
|
|
5
5
|
export const parse = (specs, argv, opts) => {
|
|
6
6
|
opts = { start: 2, showUsage: true, help: ["--help", "-h"], ...opts };
|
|
7
7
|
try {
|
package/usage.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { IObjectOf } from "@thi.ng/api";
|
|
2
|
-
import { Args, UsageOpts } from "./api";
|
|
2
|
+
import { Args, UsageOpts } from "./api.js";
|
|
3
3
|
export declare const usage: <T extends IObjectOf<any>>(specs: Args<T>, opts?: Partial<UsageOpts>) => string;
|
|
4
4
|
//# sourceMappingURL=usage.d.ts.map
|
package/usage.js
CHANGED
|
@@ -4,7 +4,7 @@ import { padRight } from "@thi.ng/strings/pad-right";
|
|
|
4
4
|
import { repeat } from "@thi.ng/strings/repeat";
|
|
5
5
|
import { stringify } from "@thi.ng/strings/stringify";
|
|
6
6
|
import { SPLIT_ANSI, wordWrapLines } from "@thi.ng/strings/word-wrap";
|
|
7
|
-
import { DEFAULT_THEME } from "./api";
|
|
7
|
+
import { DEFAULT_THEME, } from "./api.js";
|
|
8
8
|
export const usage = (specs, opts = {}) => {
|
|
9
9
|
opts = {
|
|
10
10
|
lineWidth: 80,
|