@flowscripter/dynamic-cli-framework-api 1.4.0 → 1.4.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 +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/src/ParseResult.d.ts +3 -3
- package/dist/src/ParseResult.d.ts.map +1 -1
- package/dist/src/RunResult.d.ts +2 -2
- package/dist/src/RunResult.d.ts.map +1 -1
- package/dist/src/Value.d.ts +72 -0
- package/dist/src/Value.d.ts.map +1 -0
- package/dist/src/Value.js +22 -0
- package/dist/src/argument/Argument.d.ts +8 -8
- package/dist/src/argument/Argument.d.ts.map +1 -1
- package/dist/src/argument/ComplexOption.d.ts +2 -2
- package/dist/src/argument/ComplexOption.d.ts.map +1 -1
- package/dist/src/argument/GlobalCommandArgument.d.ts +2 -2
- package/dist/src/argument/GlobalCommandArgument.d.ts.map +1 -1
- package/dist/src/argument/Option.d.ts +2 -2
- package/dist/src/argument/Option.d.ts.map +1 -1
- package/dist/src/command/GlobalCommand.d.ts +2 -2
- package/dist/src/command/GlobalCommand.d.ts.map +1 -1
- package/dist/src/command/SubCommand.d.ts +2 -2
- package/dist/src/command/SubCommand.d.ts.map +1 -1
- package/dist/src/service/core/PrompterService.d.ts +4 -4
- package/dist/src/service/core/PrompterService.d.ts.map +1 -1
- package/index.ts +8 -8
- package/package.json +1 -1
- package/src/ParseResult.ts +3 -6
- package/src/RunResult.ts +4 -7
- package/src/Value.ts +83 -0
- package/src/argument/Argument.ts +8 -15
- package/src/argument/ComplexOption.ts +2 -2
- package/src/argument/GlobalCommandArgument.ts +2 -2
- package/src/argument/Option.ts +2 -2
- package/src/command/GlobalCommand.ts +2 -2
- package/src/command/SubCommand.ts +2 -2
- package/src/service/core/PrompterService.ts +4 -4
- package/dist/src/argument/ArgumentValueTypes.d.ts +0 -68
- package/dist/src/argument/ArgumentValueTypes.d.ts.map +0 -1
- package/dist/src/argument/ArgumentValueTypes.js +0 -18
- package/src/argument/ArgumentValueTypes.ts +0 -80
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type { default as Argument } from "./src/argument/Argument.ts";
|
|
2
|
-
export type {
|
|
3
|
-
export {
|
|
2
|
+
export type { SingleValueType, Values, ValueType, PopulatedSingleValueType, PopulatedValues, PopulatedValueType, } from "./src/Value.ts";
|
|
3
|
+
export { ValueTypeName, ComplexValueTypeName } from "./src/Value.ts";
|
|
4
4
|
export type { default as ComplexOption } from "./src/argument/ComplexOption.ts";
|
|
5
5
|
export { MAXIMUM_COMPLEX_OPTION_NESTING_DEPTH } from "./src/argument/ComplexOption.ts";
|
|
6
6
|
export type { default as SubCommandArgument } from "./src/argument/SubCommandArgument.ts";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtE,YAAY,EACV,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtE,YAAY,EACV,eAAe,EACf,MAAM,EACN,SAAS,EACT,wBAAwB,EACxB,eAAe,EACf,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACrE,YAAY,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,oCAAoC,EAAE,MAAM,iCAAiC,CAAC;AACvF,YAAY,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,Y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from "./src/Value.js";
|
|
2
2
|
export { MAXIMUM_COMPLEX_OPTION_NESTING_DEPTH } from "./src/argument/ComplexOption.js";
|
|
3
3
|
export { MAXIMUM_ARGUMENT_ARRAY_SIZE } from "./src/argument/SubCommandArgument.js";
|
|
4
4
|
// Core Service IDs and types
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type Command from "./command/Command.ts";
|
|
2
2
|
import type GroupCommand from "./command/GroupCommand.ts";
|
|
3
|
-
import type {
|
|
3
|
+
import type { PopulatedSingleValueType, PopulatedValues } from "./Value.ts";
|
|
4
4
|
import type { InvalidArgument } from "./RunResult.ts";
|
|
5
5
|
/**
|
|
6
6
|
* A container holding the result of a command clause parsing operation.
|
|
@@ -17,10 +17,10 @@ export interface ParseResult {
|
|
|
17
17
|
/**
|
|
18
18
|
* The argument values populated from the command line args. If the parse result is valid
|
|
19
19
|
* (i.e. {@link invalidArguments} is empty), this can be used to execute the specified {@link command}.
|
|
20
|
-
* {@link
|
|
20
|
+
* {@link PopulatedSingleValueType} is for {@link GlobalCommand} values, {@link PopulatedValues} is for
|
|
21
21
|
* {@link SubCommand} values.
|
|
22
22
|
*/
|
|
23
|
-
readonly populatedArgumentValues:
|
|
23
|
+
readonly populatedArgumentValues: PopulatedValues | PopulatedSingleValueType;
|
|
24
24
|
/**
|
|
25
25
|
* Any arguments which were invalid.
|
|
26
26
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParseResult.d.ts","sourceRoot":"","sources":["../../src/ParseResult.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,YAAY,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ParseResult.d.ts","sourceRoot":"","sources":["../../src/ParseResult.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,YAAY,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IAErC;;;;;OAKG;IACH,QAAQ,CAAC,uBAAuB,EAAE,eAAe,GAAG,wBAAwB,CAAC;IAE7E;;OAEG;IACH,QAAQ,CAAC,gBAAgB,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAE1D;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC5C"}
|
package/dist/src/RunResult.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type Command from "./command/Command.ts";
|
|
5
5
|
import type Argument from "./argument/Argument.ts";
|
|
6
6
|
import type ComplexOption from "./argument/ComplexOption.ts";
|
|
7
|
-
import type {
|
|
7
|
+
import type { PopulatedValues, PopulatedValueType } from "./Value.ts";
|
|
8
8
|
export declare enum RunState {
|
|
9
9
|
/**
|
|
10
10
|
* Arguments were successfully parsed and the specified command(s) were successfully executed.
|
|
@@ -97,7 +97,7 @@ export interface InvalidArgument {
|
|
|
97
97
|
*
|
|
98
98
|
* NOTE: This value is unlikely to be valid as it is the cause of the invalid argument error.
|
|
99
99
|
*/
|
|
100
|
-
readonly value?:
|
|
100
|
+
readonly value?: PopulatedValues | PopulatedValueType | Array<PopulatedValues | PopulatedValueType>;
|
|
101
101
|
/**
|
|
102
102
|
* An optional message providing detail about the validation failure.
|
|
103
103
|
* Populated when {@link reason} is {@link InvalidArgumentReason.CUSTOM_VALIDATION}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RunResult.d.ts","sourceRoot":"","sources":["../../src/RunResult.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,aAAa,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"RunResult.d.ts","sourceRoot":"","sources":["../../src/RunResult.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,aAAa,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEtE,oBAAY,QAAQ;IAClB;;OAEG;IACH,OAAO,IAAI;IAEX;;OAEG;IACH,WAAW,IAAI;IAEf;;OAEG;IACH,UAAU,IAAI;IAEd;;OAEG;IACH,eAAe,IAAI;IAEnB;;OAEG;IACH,aAAa,IAAI;IAEjB;;OAEG;IACH,WAAW,MAAM;CAClB;AAED;;GAEG;AACH,oBAAY,qBAAqB;IAC/B;;OAEG;IACH,aAAa,IAAI;IAEjB;;OAEG;IACH,oBAAoB,IAAI;IAExB;;OAEG;IACH,uBAAuB,IAAI;IAE3B;;OAEG;IACH,aAAa,IAAI;IAEjB;;OAEG;IACH,oBAAoB,IAAI;IAExB;;OAEG;IACH,gBAAgB,IAAI;IAEpB;;OAEG;IACH,sBAAsB,IAAI;IAE1B;;OAEG;IACH,mBAAmB,IAAI;IAEvB;;OAEG;IACH,iBAAiB,IAAI;IAErB;;OAEG;IACH,iBAAiB,IAAI;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IAEvC;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,aAAa,CAAC;IAE7C;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EACX,eAAe,GACf,kBAAkB,GAClB,KAAK,CAAC,eAAe,GAAG,kBAAkB,CAAC,CAAC;IAEhD;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,SAAS;IAChC;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAE3D;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;CACxB"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Value shapes and type names shared by argument parsing and other framework features (e.g.
|
|
3
|
+
* `KeyValueService`) that need to represent an arbitrary JSON-ish value.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Enum of possible value types.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum ValueTypeName {
|
|
9
|
+
STRING = 0,
|
|
10
|
+
NUMBER = 1,
|
|
11
|
+
INTEGER = 2,
|
|
12
|
+
BOOLEAN = 3,
|
|
13
|
+
SECRET = 4
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Only possible value for {@link ComplexOption.type}.
|
|
17
|
+
*/
|
|
18
|
+
export declare enum ComplexValueTypeName {
|
|
19
|
+
COMPLEX = 5
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The type of a single value which is supported.
|
|
23
|
+
*
|
|
24
|
+
* NOTE: JavaScript does not have a special runtime value for INTEGER so this is covered by `number`.
|
|
25
|
+
* NOTE: `string` is also used for PASSWORD and SECRET values.
|
|
26
|
+
*/
|
|
27
|
+
export type SingleValueType = number | string | boolean;
|
|
28
|
+
/**
|
|
29
|
+
* The type of a value can be: `boolean`, `number` or `string` or an array of these.
|
|
30
|
+
*/
|
|
31
|
+
export type ValueType = SingleValueType | Array<SingleValueType>;
|
|
32
|
+
/**
|
|
33
|
+
* A container object for populated values.
|
|
34
|
+
*
|
|
35
|
+
* The following are all valid examples:
|
|
36
|
+
*
|
|
37
|
+
* * `{ }`
|
|
38
|
+
* * `{ foo: 1 }`
|
|
39
|
+
* * `{ foo: true }`
|
|
40
|
+
* * `{ foo: 'bar' }`
|
|
41
|
+
* * `{ foo: [ 1, 2 ] }`
|
|
42
|
+
* * `{ foo: [ true, true ] }`
|
|
43
|
+
* * `{ foo: [ 'bar', 'gar' ] }`
|
|
44
|
+
* * `{ foo: { a: 1 } }`
|
|
45
|
+
* * `{ foo: { a: { b: 'c'} } }`
|
|
46
|
+
* * `{ foo: [ { a: { b: 'c'} }, { a: { b: 'c'} } ] }`
|
|
47
|
+
*
|
|
48
|
+
* An array of arrays is not allowed, so the following is an INVALID example:
|
|
49
|
+
*
|
|
50
|
+
* * `{ foo: [ [ 1, 2 ], [3, 4 ] ] }`
|
|
51
|
+
*/
|
|
52
|
+
export type Values = {
|
|
53
|
+
[name: string]: ValueType | Values | Array<Values>;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Populated single value type is very similar to {@link SingleValueType} but allows for an illegal
|
|
57
|
+
* undefined value.
|
|
58
|
+
*/
|
|
59
|
+
export type PopulatedSingleValueType = SingleValueType | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Populated value types are very similar to {@link ValueType} but allow for illegal
|
|
62
|
+
* undefined values.
|
|
63
|
+
*/
|
|
64
|
+
export type PopulatedValueType = PopulatedSingleValueType | Array<PopulatedSingleValueType>;
|
|
65
|
+
/**
|
|
66
|
+
* Populated values are very similar to {@link Values} but allow for illegal
|
|
67
|
+
* undefined properties and array entries.
|
|
68
|
+
*/
|
|
69
|
+
export interface PopulatedValues {
|
|
70
|
+
[name: string]: PopulatedValueType | PopulatedValues | Array<PopulatedValues | undefined> | undefined;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=Value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Value.d.ts","sourceRoot":"","sources":["../../src/Value.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,oBAAY,aAAa;IACvB,MAAM,IAAI;IACV,MAAM,IAAI;IACV,OAAO,IAAI;IACX,OAAO,IAAI;IACX,MAAM,IAAI;CACX;AAED;;GAEG;AACH,oBAAY,oBAAoB;IAC9B,OAAO,IAAI;CACZ;AAED;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;CACpD,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,eAAe,GAAG,SAAS,CAAC;AAEnE;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,wBAAwB,GAAG,KAAK,CAAC,wBAAwB,CAAC,CAAC;AAE5F;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,CAAC,IAAI,EAAE,MAAM,GACT,kBAAkB,GAClB,eAAe,GACf,KAAK,CAAC,eAAe,GAAG,SAAS,CAAC,GAClC,SAAS,CAAC;CACf"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Value shapes and type names shared by argument parsing and other framework features (e.g.
|
|
3
|
+
* `KeyValueService`) that need to represent an arbitrary JSON-ish value.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Enum of possible value types.
|
|
7
|
+
*/
|
|
8
|
+
export var ValueTypeName;
|
|
9
|
+
(function (ValueTypeName) {
|
|
10
|
+
ValueTypeName[ValueTypeName["STRING"] = 0] = "STRING";
|
|
11
|
+
ValueTypeName[ValueTypeName["NUMBER"] = 1] = "NUMBER";
|
|
12
|
+
ValueTypeName[ValueTypeName["INTEGER"] = 2] = "INTEGER";
|
|
13
|
+
ValueTypeName[ValueTypeName["BOOLEAN"] = 3] = "BOOLEAN";
|
|
14
|
+
ValueTypeName[ValueTypeName["SECRET"] = 4] = "SECRET";
|
|
15
|
+
})(ValueTypeName || (ValueTypeName = {}));
|
|
16
|
+
/**
|
|
17
|
+
* Only possible value for {@link ComplexOption.type}.
|
|
18
|
+
*/
|
|
19
|
+
export var ComplexValueTypeName;
|
|
20
|
+
(function (ComplexValueTypeName) {
|
|
21
|
+
ComplexValueTypeName[ComplexValueTypeName["COMPLEX"] = 5] = "COMPLEX";
|
|
22
|
+
})(ComplexValueTypeName || (ComplexValueTypeName = {}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SingleValueType, Values, ValueType, ValueTypeName } from "../Value.ts";
|
|
2
2
|
/**
|
|
3
3
|
* Interface to be implemented by all {@link Command} arguments.
|
|
4
4
|
*/
|
|
@@ -6,21 +6,21 @@ export default interface Argument {
|
|
|
6
6
|
/**
|
|
7
7
|
* Type of the argument value.
|
|
8
8
|
*/
|
|
9
|
-
readonly type:
|
|
9
|
+
readonly type: ValueTypeName;
|
|
10
10
|
/**
|
|
11
|
-
* Optional list of values that the value must match. This is not supported for {@link
|
|
11
|
+
* Optional list of values that the value must match. This is not supported for {@link ValueTypeName.BOOLEAN}.
|
|
12
12
|
*/
|
|
13
|
-
readonly allowableValues?: ReadonlyArray<
|
|
13
|
+
readonly allowableValues?: ReadonlyArray<SingleValueType>;
|
|
14
14
|
/**
|
|
15
|
-
* Optional (default is `false`) for {@link
|
|
15
|
+
* Optional (default is `false`) for {@link ValueTypeName.STRING} when comparing a value against {@link allowableValues}.
|
|
16
16
|
*/
|
|
17
17
|
readonly isCaseInsensitive?: boolean;
|
|
18
18
|
/**
|
|
19
|
-
* Optional for {@link
|
|
19
|
+
* Optional for {@link ValueTypeName.INTEGER} or {@link ValueTypeName.NUMBER} when validating a value.
|
|
20
20
|
*/
|
|
21
21
|
readonly minValueInclusive?: number;
|
|
22
22
|
/**
|
|
23
|
-
* Optional for {@link
|
|
23
|
+
* Optional for {@link ValueTypeName.INTEGER} or {@link ValueTypeName.NUMBER} when validating a value.
|
|
24
24
|
*/
|
|
25
25
|
readonly maxValueInclusive?: number;
|
|
26
26
|
/**
|
|
@@ -57,6 +57,6 @@ export default interface Argument {
|
|
|
57
57
|
* }
|
|
58
58
|
* ```
|
|
59
59
|
*/
|
|
60
|
-
readonly validate?: (value:
|
|
60
|
+
readonly validate?: (value: ValueType | Values | Array<Values>) => string | undefined;
|
|
61
61
|
}
|
|
62
62
|
//# sourceMappingURL=Argument.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Argument.d.ts","sourceRoot":"","sources":["../../../src/argument/Argument.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Argument.d.ts","sourceRoot":"","sources":["../../../src/argument/Argument.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAErF;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,QAAQ;IAC/B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAE1D;;OAEG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAEpC;;OAEG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAEpC;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAEnC;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,MAAM,GAAG,SAAS,CAAC;CACvF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type Option from "./Option.ts";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Values, ComplexValueTypeName } from "../Value.ts";
|
|
3
3
|
export declare const MAXIMUM_COMPLEX_OPTION_NESTING_DEPTH = 10;
|
|
4
4
|
/**
|
|
5
5
|
* A container option argument for defining {@link SubCommand} nested argument hierarchies.
|
|
@@ -16,6 +16,6 @@ export default interface ComplexOption extends Omit<Option, "type" | "defaultVal
|
|
|
16
16
|
/**
|
|
17
17
|
* Default value for the argument if not specified.
|
|
18
18
|
*/
|
|
19
|
-
readonly defaultValue?:
|
|
19
|
+
readonly defaultValue?: Values | Array<Values>;
|
|
20
20
|
}
|
|
21
21
|
//# sourceMappingURL=ComplexOption.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComplexOption.d.ts","sourceRoot":"","sources":["../../../src/argument/ComplexOption.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ComplexOption.d.ts","sourceRoot":"","sources":["../../../src/argument/ComplexOption.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEhE,eAAO,MAAM,oCAAoC,KAAK,CAAC;AAEvD;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,aAAc,SAAQ,IAAI,CACjD,MAAM,EACN,MAAM,GAAG,cAAc,GAAG,iBAAiB,CAC5C;IACC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IAEpC;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC,CAAC;IAE3D;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;CAChD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type Argument from "./Argument.ts";
|
|
2
|
-
import type {
|
|
2
|
+
import type { SingleValueType } from "../Value.ts";
|
|
3
3
|
/**
|
|
4
4
|
* Interface to be implemented by a single {@link Argument} defined by a {@link GlobalCommand}.
|
|
5
5
|
*/
|
|
@@ -7,7 +7,7 @@ export default interface GlobalCommandArgument extends Argument {
|
|
|
7
7
|
/**
|
|
8
8
|
* Default value for the argument if not specified.
|
|
9
9
|
*/
|
|
10
|
-
readonly defaultValue?:
|
|
10
|
+
readonly defaultValue?: SingleValueType;
|
|
11
11
|
/**
|
|
12
12
|
* If this is `true` the argument does not need to be specified nor have a default value. The default is `false`.
|
|
13
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalCommandArgument.d.ts","sourceRoot":"","sources":["../../../src/argument/GlobalCommandArgument.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"GlobalCommandArgument.d.ts","sourceRoot":"","sources":["../../../src/argument/GlobalCommandArgument.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,qBAAsB,SAAQ,QAAQ;IAC7D;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,eAAe,CAAC;IAExC;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAC/B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ValueType } from "../Value.ts";
|
|
2
2
|
import type SubCommandArgument from "./SubCommandArgument.ts";
|
|
3
3
|
/**
|
|
4
4
|
* Interface for {@link SubCommand} option arguments.
|
|
@@ -13,7 +13,7 @@ export default interface Option extends SubCommandArgument {
|
|
|
13
13
|
/**
|
|
14
14
|
* Default value for the argument if not specified.
|
|
15
15
|
*/
|
|
16
|
-
readonly defaultValue?:
|
|
16
|
+
readonly defaultValue?: ValueType;
|
|
17
17
|
/**
|
|
18
18
|
* If this is `true` the option does not need to be specified nor have a default value.
|
|
19
19
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Option.d.ts","sourceRoot":"","sources":["../../../src/argument/Option.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Option.d.ts","sourceRoot":"","sources":["../../../src/argument/Option.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAC;AAE9D;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,MAAO,SAAQ,kBAAkB;IACxD;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,CAAC;IAElC;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAE9B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type Command from "./Command.ts";
|
|
2
2
|
import type GlobalCommandArgument from "../argument/GlobalCommandArgument.ts";
|
|
3
3
|
import type Context from "../Context.ts";
|
|
4
|
-
import type {
|
|
4
|
+
import type { SingleValueType } from "../Value.ts";
|
|
5
5
|
/**
|
|
6
6
|
* Interface for a global command.
|
|
7
7
|
*/
|
|
@@ -23,6 +23,6 @@ export default interface GlobalCommand extends Command {
|
|
|
23
23
|
* @param argumentValue optional argument value for the command. This will be populated unless
|
|
24
24
|
* the command's {@link GlobalCommandArgument} is optional and the argument value was not provided.
|
|
25
25
|
*/
|
|
26
|
-
execute(context: Context, argumentValue?:
|
|
26
|
+
execute(context: Context, argumentValue?: SingleValueType): Promise<void>;
|
|
27
27
|
}
|
|
28
28
|
//# sourceMappingURL=GlobalCommand.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalCommand.d.ts","sourceRoot":"","sources":["../../../src/command/GlobalCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,qBAAqB,MAAM,sCAAsC,CAAC;AAC9E,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"GlobalCommand.d.ts","sourceRoot":"","sources":["../../../src/command/GlobalCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,qBAAqB,MAAM,sCAAsC,CAAC;AAC9E,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,aAAc,SAAQ,OAAO;IACpD;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IAE1C;;;;;;OAMG;IACH,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3E"}
|
|
@@ -3,7 +3,7 @@ import type Option from "../argument/Option.ts";
|
|
|
3
3
|
import type Positional from "../argument/Positional.ts";
|
|
4
4
|
import type UsageExample from "./UsageExample.ts";
|
|
5
5
|
import type ComplexOption from "../argument/ComplexOption.ts";
|
|
6
|
-
import type {
|
|
6
|
+
import type { Values } from "../Value.ts";
|
|
7
7
|
import type Context from "../Context.ts";
|
|
8
8
|
/**
|
|
9
9
|
* Interface for a sub-command.
|
|
@@ -32,6 +32,6 @@ export default interface SubCommand extends Command {
|
|
|
32
32
|
* @param argumentValues the argument values for the command. This may be empty if
|
|
33
33
|
* the command's {@link Option} and {@link Positional} instances are all optional and no argument values were provided.
|
|
34
34
|
*/
|
|
35
|
-
execute(context: Context, argumentValues:
|
|
35
|
+
execute(context: Context, argumentValues: Values): Promise<void>;
|
|
36
36
|
}
|
|
37
37
|
//# sourceMappingURL=SubCommand.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubCommand.d.ts","sourceRoot":"","sources":["../../../src/command/SubCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,KAAK,UAAU,MAAM,2BAA2B,CAAC;AACxD,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,aAAa,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"SubCommand.d.ts","sourceRoot":"","sources":["../../../src/command/SubCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,KAAK,UAAU,MAAM,2BAA2B,CAAC;AACxD,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,aAAa,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,UAAW,SAAQ,OAAO;IACjD;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC,CAAC;IAExD;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IAEhD;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IAErD;;;;;;OAMG;IACH,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SingleValueType } from "../../Value.ts";
|
|
2
2
|
export declare const PROMPTER_SERVICE_ID = "@flowscripter/dynamic-cli-framework/prompter-service";
|
|
3
3
|
export declare enum PromptType {
|
|
4
4
|
SINGLE_SELECT = 0,
|
|
@@ -10,10 +10,10 @@ export declare enum PromptType {
|
|
|
10
10
|
}
|
|
11
11
|
export interface PromptOption {
|
|
12
12
|
readonly displayValue: string;
|
|
13
|
-
readonly returnedValue:
|
|
13
|
+
readonly returnedValue: SingleValueType;
|
|
14
14
|
readonly min?: number;
|
|
15
15
|
readonly max?: number;
|
|
16
|
-
readonly validate?: (value:
|
|
16
|
+
readonly validate?: (value: SingleValueType) => string | undefined;
|
|
17
17
|
}
|
|
18
18
|
export interface Prompt {
|
|
19
19
|
readonly name: string;
|
|
@@ -25,7 +25,7 @@ export interface Prompt {
|
|
|
25
25
|
}
|
|
26
26
|
export interface PromptResult {
|
|
27
27
|
readonly name: string;
|
|
28
|
-
readonly value:
|
|
28
|
+
readonly value: SingleValueType | ReadonlyArray<SingleValueType>;
|
|
29
29
|
}
|
|
30
30
|
export default interface PrompterService {
|
|
31
31
|
promptEnabled: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrompterService.d.ts","sourceRoot":"","sources":["../../../../src/service/core/PrompterService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"PrompterService.d.ts","sourceRoot":"","sources":["../../../../src/service/core/PrompterService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,eAAO,MAAM,mBAAmB,yDAAyD,CAAC;AAE1F,oBAAY,UAAU;IACpB,aAAa,IAAI;IACjB,YAAY,IAAI;IAChB,WAAW,IAAI;IACf,MAAM,IAAI;IACV,IAAI,IAAI;IACR,QAAQ,IAAI;CACb;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,eAAe,CAAC;IACxC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,MAAM,GAAG,SAAS,CAAC;CACpE;AAED,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,CAAC,EAAE,YAAY,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,aAAa,CAAC,eAAe,CAAC,CAAC;CAClE;AAED,MAAM,CAAC,OAAO,WAAW,eAAe;IACtC,aAAa,EAAE,OAAO,CAAC;IAEvB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAE9C,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC;CACjF"}
|
package/index.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// Argument API
|
|
2
2
|
export type { default as Argument } from "./src/argument/Argument.ts";
|
|
3
3
|
export type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from "./src/
|
|
11
|
-
export {
|
|
4
|
+
SingleValueType,
|
|
5
|
+
Values,
|
|
6
|
+
ValueType,
|
|
7
|
+
PopulatedSingleValueType,
|
|
8
|
+
PopulatedValues,
|
|
9
|
+
PopulatedValueType,
|
|
10
|
+
} from "./src/Value.ts";
|
|
11
|
+
export { ValueTypeName, ComplexValueTypeName } from "./src/Value.ts";
|
|
12
12
|
export type { default as ComplexOption } from "./src/argument/ComplexOption.ts";
|
|
13
13
|
export { MAXIMUM_COMPLEX_OPTION_NESTING_DEPTH } from "./src/argument/ComplexOption.ts";
|
|
14
14
|
export type { default as SubCommandArgument } from "./src/argument/SubCommandArgument.ts";
|
package/package.json
CHANGED
package/src/ParseResult.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type Command from "./command/Command.ts";
|
|
2
2
|
import type GroupCommand from "./command/GroupCommand.ts";
|
|
3
|
-
import type {
|
|
4
|
-
PopulatedArgumentSingleValueType,
|
|
5
|
-
PopulatedArgumentValues,
|
|
6
|
-
} from "./argument/ArgumentValueTypes.ts";
|
|
3
|
+
import type { PopulatedSingleValueType, PopulatedValues } from "./Value.ts";
|
|
7
4
|
import type { InvalidArgument } from "./RunResult.ts";
|
|
8
5
|
|
|
9
6
|
/**
|
|
@@ -23,10 +20,10 @@ export interface ParseResult {
|
|
|
23
20
|
/**
|
|
24
21
|
* The argument values populated from the command line args. If the parse result is valid
|
|
25
22
|
* (i.e. {@link invalidArguments} is empty), this can be used to execute the specified {@link command}.
|
|
26
|
-
* {@link
|
|
23
|
+
* {@link PopulatedSingleValueType} is for {@link GlobalCommand} values, {@link PopulatedValues} is for
|
|
27
24
|
* {@link SubCommand} values.
|
|
28
25
|
*/
|
|
29
|
-
readonly populatedArgumentValues:
|
|
26
|
+
readonly populatedArgumentValues: PopulatedValues | PopulatedSingleValueType;
|
|
30
27
|
|
|
31
28
|
/**
|
|
32
29
|
* Any arguments which were invalid.
|
package/src/RunResult.ts
CHANGED
|
@@ -4,10 +4,7 @@
|
|
|
4
4
|
import type Command from "./command/Command.ts";
|
|
5
5
|
import type Argument from "./argument/Argument.ts";
|
|
6
6
|
import type ComplexOption from "./argument/ComplexOption.ts";
|
|
7
|
-
import type {
|
|
8
|
-
PopulatedArgumentValues,
|
|
9
|
-
PopulatedArgumentValueType,
|
|
10
|
-
} from "./argument/ArgumentValueTypes.ts";
|
|
7
|
+
import type { PopulatedValues, PopulatedValueType } from "./Value.ts";
|
|
11
8
|
|
|
12
9
|
export enum RunState {
|
|
13
10
|
/**
|
|
@@ -121,9 +118,9 @@ export interface InvalidArgument {
|
|
|
121
118
|
* NOTE: This value is unlikely to be valid as it is the cause of the invalid argument error.
|
|
122
119
|
*/
|
|
123
120
|
readonly value?:
|
|
124
|
-
|
|
|
125
|
-
|
|
|
126
|
-
| Array<
|
|
121
|
+
| PopulatedValues
|
|
122
|
+
| PopulatedValueType
|
|
123
|
+
| Array<PopulatedValues | PopulatedValueType>;
|
|
127
124
|
|
|
128
125
|
/**
|
|
129
126
|
* An optional message providing detail about the validation failure.
|
package/src/Value.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Value shapes and type names shared by argument parsing and other framework features (e.g.
|
|
3
|
+
* `KeyValueService`) that need to represent an arbitrary JSON-ish value.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Enum of possible value types.
|
|
8
|
+
*/
|
|
9
|
+
export enum ValueTypeName {
|
|
10
|
+
STRING = 0,
|
|
11
|
+
NUMBER = 1,
|
|
12
|
+
INTEGER = 2,
|
|
13
|
+
BOOLEAN = 3,
|
|
14
|
+
SECRET = 4,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Only possible value for {@link ComplexOption.type}.
|
|
19
|
+
*/
|
|
20
|
+
export enum ComplexValueTypeName {
|
|
21
|
+
COMPLEX = 5,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The type of a single value which is supported.
|
|
26
|
+
*
|
|
27
|
+
* NOTE: JavaScript does not have a special runtime value for INTEGER so this is covered by `number`.
|
|
28
|
+
* NOTE: `string` is also used for PASSWORD and SECRET values.
|
|
29
|
+
*/
|
|
30
|
+
export type SingleValueType = number | string | boolean;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The type of a value can be: `boolean`, `number` or `string` or an array of these.
|
|
34
|
+
*/
|
|
35
|
+
export type ValueType = SingleValueType | Array<SingleValueType>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A container object for populated values.
|
|
39
|
+
*
|
|
40
|
+
* The following are all valid examples:
|
|
41
|
+
*
|
|
42
|
+
* * `{ }`
|
|
43
|
+
* * `{ foo: 1 }`
|
|
44
|
+
* * `{ foo: true }`
|
|
45
|
+
* * `{ foo: 'bar' }`
|
|
46
|
+
* * `{ foo: [ 1, 2 ] }`
|
|
47
|
+
* * `{ foo: [ true, true ] }`
|
|
48
|
+
* * `{ foo: [ 'bar', 'gar' ] }`
|
|
49
|
+
* * `{ foo: { a: 1 } }`
|
|
50
|
+
* * `{ foo: { a: { b: 'c'} } }`
|
|
51
|
+
* * `{ foo: [ { a: { b: 'c'} }, { a: { b: 'c'} } ] }`
|
|
52
|
+
*
|
|
53
|
+
* An array of arrays is not allowed, so the following is an INVALID example:
|
|
54
|
+
*
|
|
55
|
+
* * `{ foo: [ [ 1, 2 ], [3, 4 ] ] }`
|
|
56
|
+
*/
|
|
57
|
+
export type Values = {
|
|
58
|
+
[name: string]: ValueType | Values | Array<Values>;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Populated single value type is very similar to {@link SingleValueType} but allows for an illegal
|
|
63
|
+
* undefined value.
|
|
64
|
+
*/
|
|
65
|
+
export type PopulatedSingleValueType = SingleValueType | undefined;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Populated value types are very similar to {@link ValueType} but allow for illegal
|
|
69
|
+
* undefined values.
|
|
70
|
+
*/
|
|
71
|
+
export type PopulatedValueType = PopulatedSingleValueType | Array<PopulatedSingleValueType>;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Populated values are very similar to {@link Values} but allow for illegal
|
|
75
|
+
* undefined properties and array entries.
|
|
76
|
+
*/
|
|
77
|
+
export interface PopulatedValues {
|
|
78
|
+
[name: string]:
|
|
79
|
+
| PopulatedValueType
|
|
80
|
+
| PopulatedValues
|
|
81
|
+
| Array<PopulatedValues | undefined>
|
|
82
|
+
| undefined;
|
|
83
|
+
}
|
package/src/argument/Argument.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
ArgumentSingleValueType,
|
|
3
|
-
ArgumentValues,
|
|
4
|
-
ArgumentValueType,
|
|
5
|
-
ArgumentValueTypeName,
|
|
6
|
-
} from "./ArgumentValueTypes.ts";
|
|
1
|
+
import type { SingleValueType, Values, ValueType, ValueTypeName } from "../Value.ts";
|
|
7
2
|
|
|
8
3
|
/**
|
|
9
4
|
* Interface to be implemented by all {@link Command} arguments.
|
|
@@ -12,25 +7,25 @@ export default interface Argument {
|
|
|
12
7
|
/**
|
|
13
8
|
* Type of the argument value.
|
|
14
9
|
*/
|
|
15
|
-
readonly type:
|
|
10
|
+
readonly type: ValueTypeName;
|
|
16
11
|
|
|
17
12
|
/**
|
|
18
|
-
* Optional list of values that the value must match. This is not supported for {@link
|
|
13
|
+
* Optional list of values that the value must match. This is not supported for {@link ValueTypeName.BOOLEAN}.
|
|
19
14
|
*/
|
|
20
|
-
readonly allowableValues?: ReadonlyArray<
|
|
15
|
+
readonly allowableValues?: ReadonlyArray<SingleValueType>;
|
|
21
16
|
|
|
22
17
|
/**
|
|
23
|
-
* Optional (default is `false`) for {@link
|
|
18
|
+
* Optional (default is `false`) for {@link ValueTypeName.STRING} when comparing a value against {@link allowableValues}.
|
|
24
19
|
*/
|
|
25
20
|
readonly isCaseInsensitive?: boolean;
|
|
26
21
|
|
|
27
22
|
/**
|
|
28
|
-
* Optional for {@link
|
|
23
|
+
* Optional for {@link ValueTypeName.INTEGER} or {@link ValueTypeName.NUMBER} when validating a value.
|
|
29
24
|
*/
|
|
30
25
|
readonly minValueInclusive?: number;
|
|
31
26
|
|
|
32
27
|
/**
|
|
33
|
-
* Optional for {@link
|
|
28
|
+
* Optional for {@link ValueTypeName.INTEGER} or {@link ValueTypeName.NUMBER} when validating a value.
|
|
34
29
|
*/
|
|
35
30
|
readonly maxValueInclusive?: number;
|
|
36
31
|
|
|
@@ -69,7 +64,5 @@ export default interface Argument {
|
|
|
69
64
|
* }
|
|
70
65
|
* ```
|
|
71
66
|
*/
|
|
72
|
-
readonly validate?: (
|
|
73
|
-
value: ArgumentValueType | ArgumentValues | Array<ArgumentValues>,
|
|
74
|
-
) => string | undefined;
|
|
67
|
+
readonly validate?: (value: ValueType | Values | Array<Values>) => string | undefined;
|
|
75
68
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type Option from "./Option.ts";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Values, ComplexValueTypeName } from "../Value.ts";
|
|
3
3
|
|
|
4
4
|
export const MAXIMUM_COMPLEX_OPTION_NESTING_DEPTH = 10;
|
|
5
5
|
|
|
@@ -23,5 +23,5 @@ export default interface ComplexOption extends Omit<
|
|
|
23
23
|
/**
|
|
24
24
|
* Default value for the argument if not specified.
|
|
25
25
|
*/
|
|
26
|
-
readonly defaultValue?:
|
|
26
|
+
readonly defaultValue?: Values | Array<Values>;
|
|
27
27
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type Argument from "./Argument.ts";
|
|
2
|
-
import type {
|
|
2
|
+
import type { SingleValueType } from "../Value.ts";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Interface to be implemented by a single {@link Argument} defined by a {@link GlobalCommand}.
|
|
@@ -8,7 +8,7 @@ export default interface GlobalCommandArgument extends Argument {
|
|
|
8
8
|
/**
|
|
9
9
|
* Default value for the argument if not specified.
|
|
10
10
|
*/
|
|
11
|
-
readonly defaultValue?:
|
|
11
|
+
readonly defaultValue?: SingleValueType;
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* If this is `true` the argument does not need to be specified nor have a default value. The default is `false`.
|
package/src/argument/Option.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ValueType } from "../Value.ts";
|
|
2
2
|
import type SubCommandArgument from "./SubCommandArgument.ts";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -15,7 +15,7 @@ export default interface Option extends SubCommandArgument {
|
|
|
15
15
|
/**
|
|
16
16
|
* Default value for the argument if not specified.
|
|
17
17
|
*/
|
|
18
|
-
readonly defaultValue?:
|
|
18
|
+
readonly defaultValue?: ValueType;
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* If this is `true` the option does not need to be specified nor have a default value.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type Command from "./Command.ts";
|
|
2
2
|
import type GlobalCommandArgument from "../argument/GlobalCommandArgument.ts";
|
|
3
3
|
import type Context from "../Context.ts";
|
|
4
|
-
import type {
|
|
4
|
+
import type { SingleValueType } from "../Value.ts";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Interface for a global command.
|
|
@@ -26,5 +26,5 @@ export default interface GlobalCommand extends Command {
|
|
|
26
26
|
* @param argumentValue optional argument value for the command. This will be populated unless
|
|
27
27
|
* the command's {@link GlobalCommandArgument} is optional and the argument value was not provided.
|
|
28
28
|
*/
|
|
29
|
-
execute(context: Context, argumentValue?:
|
|
29
|
+
execute(context: Context, argumentValue?: SingleValueType): Promise<void>;
|
|
30
30
|
}
|
|
@@ -3,7 +3,7 @@ import type Option from "../argument/Option.ts";
|
|
|
3
3
|
import type Positional from "../argument/Positional.ts";
|
|
4
4
|
import type UsageExample from "./UsageExample.ts";
|
|
5
5
|
import type ComplexOption from "../argument/ComplexOption.ts";
|
|
6
|
-
import type {
|
|
6
|
+
import type { Values } from "../Value.ts";
|
|
7
7
|
import type Context from "../Context.ts";
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -37,5 +37,5 @@ export default interface SubCommand extends Command {
|
|
|
37
37
|
* @param argumentValues the argument values for the command. This may be empty if
|
|
38
38
|
* the command's {@link Option} and {@link Positional} instances are all optional and no argument values were provided.
|
|
39
39
|
*/
|
|
40
|
-
execute(context: Context, argumentValues:
|
|
40
|
+
execute(context: Context, argumentValues: Values): Promise<void>;
|
|
41
41
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SingleValueType } from "../../Value.ts";
|
|
2
2
|
|
|
3
3
|
export const PROMPTER_SERVICE_ID = "@flowscripter/dynamic-cli-framework/prompter-service";
|
|
4
4
|
|
|
@@ -13,10 +13,10 @@ export enum PromptType {
|
|
|
13
13
|
|
|
14
14
|
export interface PromptOption {
|
|
15
15
|
readonly displayValue: string;
|
|
16
|
-
readonly returnedValue:
|
|
16
|
+
readonly returnedValue: SingleValueType;
|
|
17
17
|
readonly min?: number;
|
|
18
18
|
readonly max?: number;
|
|
19
|
-
readonly validate?: (value:
|
|
19
|
+
readonly validate?: (value: SingleValueType) => string | undefined;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export interface Prompt {
|
|
@@ -30,7 +30,7 @@ export interface Prompt {
|
|
|
30
30
|
|
|
31
31
|
export interface PromptResult {
|
|
32
32
|
readonly name: string;
|
|
33
|
-
readonly value:
|
|
33
|
+
readonly value: SingleValueType | ReadonlyArray<SingleValueType>;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export default interface PrompterService {
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The type of single {@link Argument} values which are supported.
|
|
3
|
-
*
|
|
4
|
-
* NOTE: JavaScript does not have a special runtime value for INTEGER so this is covered by `number`.
|
|
5
|
-
* NOTE: `string` is also used for PASSWORD values.
|
|
6
|
-
*/
|
|
7
|
-
export type ArgumentSingleValueType = number | string | boolean;
|
|
8
|
-
/**
|
|
9
|
-
* The type of the value to be parsed as an argument can be: `boolean`, `number` or `string` or an array of these.
|
|
10
|
-
*/
|
|
11
|
-
export type ArgumentValueType = ArgumentSingleValueType | Array<ArgumentSingleValueType>;
|
|
12
|
-
/**
|
|
13
|
-
* A container object for populated argument values.
|
|
14
|
-
*
|
|
15
|
-
* The following are all valid examples:
|
|
16
|
-
*
|
|
17
|
-
* * `{ }`
|
|
18
|
-
* * `{ foo: 1 }`
|
|
19
|
-
* * `{ foo: true }`
|
|
20
|
-
* * `{ foo: 'bar' }`
|
|
21
|
-
* * `{ foo: [ 1, 2 ] }`
|
|
22
|
-
* * `{ foo: [ true, true ] }`
|
|
23
|
-
* * `{ foo: [ 'bar', 'gar' ] }`
|
|
24
|
-
* * `{ foo: { a: 1 } }`
|
|
25
|
-
* * `{ foo: { a: { b: 'c'} } }`
|
|
26
|
-
* * `{ foo: [ { a: { b: 'c'} }, { a: { b: 'c'} } ] }`
|
|
27
|
-
*
|
|
28
|
-
* An array of arrays is not allowed, so the following is an INVALID example:
|
|
29
|
-
*
|
|
30
|
-
* * `{ foo: [ [ 1, 2 ], [3, 4 ] ] }`
|
|
31
|
-
*/
|
|
32
|
-
export type ArgumentValues = {
|
|
33
|
-
[argName: string]: ArgumentValueType | ArgumentValues | Array<ArgumentValues>;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Enum of possible {@link Argument} value types.
|
|
37
|
-
*/
|
|
38
|
-
export declare enum ArgumentValueTypeName {
|
|
39
|
-
STRING = 0,
|
|
40
|
-
NUMBER = 1,
|
|
41
|
-
INTEGER = 2,
|
|
42
|
-
BOOLEAN = 3,
|
|
43
|
-
SECRET = 4
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Only possible value for {@link ComplexOption.type}.
|
|
47
|
-
*/
|
|
48
|
-
export declare enum ComplexValueTypeName {
|
|
49
|
-
COMPLEX = 5
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Populated single value type is very similar to {@link ArgumentSingleValueType} but allows for an illegal
|
|
53
|
-
* undefined value.
|
|
54
|
-
*/
|
|
55
|
-
export type PopulatedArgumentSingleValueType = ArgumentSingleValueType | undefined;
|
|
56
|
-
/**
|
|
57
|
-
* Populated argument value types are very similar to {@link ArgumentValueType} but allow for illegal
|
|
58
|
-
* undefined values.
|
|
59
|
-
*/
|
|
60
|
-
export type PopulatedArgumentValueType = PopulatedArgumentSingleValueType | Array<PopulatedArgumentSingleValueType>;
|
|
61
|
-
/**
|
|
62
|
-
* Populated values are very similar to {@link ArgumentValues} but allow for illegal
|
|
63
|
-
* undefined properties and array entries.
|
|
64
|
-
*/
|
|
65
|
-
export interface PopulatedArgumentValues {
|
|
66
|
-
[argName: string]: PopulatedArgumentValueType | PopulatedArgumentValues | Array<PopulatedArgumentValues | undefined> | undefined;
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=ArgumentValueTypes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ArgumentValueTypes.d.ts","sourceRoot":"","sources":["../../../src/argument/ArgumentValueTypes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG,KAAK,CAAC,uBAAuB,CAAC,CAAC;AAEzF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,GAAG,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;CAC/E,CAAC;AAEF;;GAEG;AACH,oBAAY,qBAAqB;IAC/B,MAAM,IAAI;IACV,MAAM,IAAI;IACV,OAAO,IAAI;IACX,OAAO,IAAI;IACX,MAAM,IAAI;CACX;AAED;;GAEG;AACH,oBAAY,oBAAoB;IAC9B,OAAO,IAAI;CACZ;AAED;;;GAGG;AACH,MAAM,MAAM,gCAAgC,GAAG,uBAAuB,GAAG,SAAS,CAAC;AAEnF;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAClC,gCAAgC,GAChC,KAAK,CAAC,gCAAgC,CAAC,CAAC;AAE5C;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,CAAC,OAAO,EAAE,MAAM,GACZ,0BAA0B,GAC1B,uBAAuB,GACvB,KAAK,CAAC,uBAAuB,GAAG,SAAS,CAAC,GAC1C,SAAS,CAAC;CACf"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enum of possible {@link Argument} value types.
|
|
3
|
-
*/
|
|
4
|
-
export var ArgumentValueTypeName;
|
|
5
|
-
(function (ArgumentValueTypeName) {
|
|
6
|
-
ArgumentValueTypeName[ArgumentValueTypeName["STRING"] = 0] = "STRING";
|
|
7
|
-
ArgumentValueTypeName[ArgumentValueTypeName["NUMBER"] = 1] = "NUMBER";
|
|
8
|
-
ArgumentValueTypeName[ArgumentValueTypeName["INTEGER"] = 2] = "INTEGER";
|
|
9
|
-
ArgumentValueTypeName[ArgumentValueTypeName["BOOLEAN"] = 3] = "BOOLEAN";
|
|
10
|
-
ArgumentValueTypeName[ArgumentValueTypeName["SECRET"] = 4] = "SECRET";
|
|
11
|
-
})(ArgumentValueTypeName || (ArgumentValueTypeName = {}));
|
|
12
|
-
/**
|
|
13
|
-
* Only possible value for {@link ComplexOption.type}.
|
|
14
|
-
*/
|
|
15
|
-
export var ComplexValueTypeName;
|
|
16
|
-
(function (ComplexValueTypeName) {
|
|
17
|
-
ComplexValueTypeName[ComplexValueTypeName["COMPLEX"] = 5] = "COMPLEX";
|
|
18
|
-
})(ComplexValueTypeName || (ComplexValueTypeName = {}));
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The type of single {@link Argument} values which are supported.
|
|
3
|
-
*
|
|
4
|
-
* NOTE: JavaScript does not have a special runtime value for INTEGER so this is covered by `number`.
|
|
5
|
-
* NOTE: `string` is also used for PASSWORD values.
|
|
6
|
-
*/
|
|
7
|
-
export type ArgumentSingleValueType = number | string | boolean;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* The type of the value to be parsed as an argument can be: `boolean`, `number` or `string` or an array of these.
|
|
11
|
-
*/
|
|
12
|
-
export type ArgumentValueType = ArgumentSingleValueType | Array<ArgumentSingleValueType>;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* A container object for populated argument values.
|
|
16
|
-
*
|
|
17
|
-
* The following are all valid examples:
|
|
18
|
-
*
|
|
19
|
-
* * `{ }`
|
|
20
|
-
* * `{ foo: 1 }`
|
|
21
|
-
* * `{ foo: true }`
|
|
22
|
-
* * `{ foo: 'bar' }`
|
|
23
|
-
* * `{ foo: [ 1, 2 ] }`
|
|
24
|
-
* * `{ foo: [ true, true ] }`
|
|
25
|
-
* * `{ foo: [ 'bar', 'gar' ] }`
|
|
26
|
-
* * `{ foo: { a: 1 } }`
|
|
27
|
-
* * `{ foo: { a: { b: 'c'} } }`
|
|
28
|
-
* * `{ foo: [ { a: { b: 'c'} }, { a: { b: 'c'} } ] }`
|
|
29
|
-
*
|
|
30
|
-
* An array of arrays is not allowed, so the following is an INVALID example:
|
|
31
|
-
*
|
|
32
|
-
* * `{ foo: [ [ 1, 2 ], [3, 4 ] ] }`
|
|
33
|
-
*/
|
|
34
|
-
export type ArgumentValues = {
|
|
35
|
-
[argName: string]: ArgumentValueType | ArgumentValues | Array<ArgumentValues>;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Enum of possible {@link Argument} value types.
|
|
40
|
-
*/
|
|
41
|
-
export enum ArgumentValueTypeName {
|
|
42
|
-
STRING = 0,
|
|
43
|
-
NUMBER = 1,
|
|
44
|
-
INTEGER = 2,
|
|
45
|
-
BOOLEAN = 3,
|
|
46
|
-
SECRET = 4,
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Only possible value for {@link ComplexOption.type}.
|
|
51
|
-
*/
|
|
52
|
-
export enum ComplexValueTypeName {
|
|
53
|
-
COMPLEX = 5,
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Populated single value type is very similar to {@link ArgumentSingleValueType} but allows for an illegal
|
|
58
|
-
* undefined value.
|
|
59
|
-
*/
|
|
60
|
-
export type PopulatedArgumentSingleValueType = ArgumentSingleValueType | undefined;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Populated argument value types are very similar to {@link ArgumentValueType} but allow for illegal
|
|
64
|
-
* undefined values.
|
|
65
|
-
*/
|
|
66
|
-
export type PopulatedArgumentValueType =
|
|
67
|
-
| PopulatedArgumentSingleValueType
|
|
68
|
-
| Array<PopulatedArgumentSingleValueType>;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Populated values are very similar to {@link ArgumentValues} but allow for illegal
|
|
72
|
-
* undefined properties and array entries.
|
|
73
|
-
*/
|
|
74
|
-
export interface PopulatedArgumentValues {
|
|
75
|
-
[argName: string]:
|
|
76
|
-
| PopulatedArgumentValueType
|
|
77
|
-
| PopulatedArgumentValues
|
|
78
|
-
| Array<PopulatedArgumentValues | undefined>
|
|
79
|
-
| undefined;
|
|
80
|
-
}
|