@cli-forge/parser 0.1.0 → 0.2.0
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 +10 -1
- package/src/lib/parser.d.ts +79 -0
- package/src/lib/parser.js +52 -2
- package/src/lib/parser.js.map +1 -1
- package/src/lib/utils.d.ts +1 -0
- package/src/lib/utils.js +7 -0
- package/src/lib/utils.js.map +1 -0
package/package.json
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cli-forge/parser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"tslib": "^2.3.0"
|
|
6
6
|
},
|
|
7
7
|
"type": "commonjs",
|
|
8
8
|
"main": "./src/index.js",
|
|
9
9
|
"typings": "./src/index.d.ts",
|
|
10
|
+
"license": "ISC",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"directory": "packages/parser",
|
|
14
|
+
"url": "https://github.com/AgentEnder/cli-forge"
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
10
19
|
"types": "./src/index.d.ts"
|
|
11
20
|
}
|
package/src/lib/parser.d.ts
CHANGED
|
@@ -49,43 +49,122 @@ export type NumberArrayOptionConfig<TCoerce = number> = {
|
|
|
49
49
|
type: 'array';
|
|
50
50
|
items: 'number';
|
|
51
51
|
} & CommonOptionConfig<number[], TCoerce>;
|
|
52
|
+
/**
|
|
53
|
+
* Configuration for array options. Arrays are parsed from
|
|
54
|
+
* comma separated, space separated, or multiple values.
|
|
55
|
+
*
|
|
56
|
+
* e.g. `--foo a b c`, `--foo a,b,c`, or `--foo a --foo b --foo c`
|
|
57
|
+
*/
|
|
52
58
|
export type ArrayOptionConfig<TCoerce = string | number> = StringArrayOptionConfig<TCoerce> | NumberArrayOptionConfig<TCoerce>;
|
|
59
|
+
/**
|
|
60
|
+
* Configures an option for the parser. See subtypes for more information.
|
|
61
|
+
* - {@link StringOptionConfig}
|
|
62
|
+
* - {@link NumberOptionConfig}
|
|
63
|
+
* - {@link ArrayOptionConfig}
|
|
64
|
+
* - {@link BooleanOptionConfig}
|
|
65
|
+
*
|
|
66
|
+
* @typeParam TCoerce The return type of the `coerce` function if provided.
|
|
67
|
+
*/
|
|
53
68
|
export type OptionConfig<TCoerce = any> = StringOptionConfig<TCoerce> | NumberOptionConfig<TCoerce> | ArrayOptionConfig<TCoerce> | BooleanOptionConfig<TCoerce>;
|
|
54
69
|
type InternalOptionConfig = OptionConfig & {
|
|
55
70
|
key: string;
|
|
56
71
|
position?: number;
|
|
57
72
|
};
|
|
73
|
+
/**
|
|
74
|
+
* Base type for parsed arguments.
|
|
75
|
+
*/
|
|
58
76
|
export type ParsedArgs = {
|
|
77
|
+
/**
|
|
78
|
+
* Contains any unmatched arguments as originally passed to the parser.
|
|
79
|
+
*/
|
|
59
80
|
unmatched: string[];
|
|
81
|
+
/**
|
|
82
|
+
* Contains any arguments passed after `--`, which halts parsing of flags.
|
|
83
|
+
*/
|
|
60
84
|
'--'?: string[];
|
|
61
85
|
};
|
|
86
|
+
/**
|
|
87
|
+
* Extra options for the parser
|
|
88
|
+
*/
|
|
62
89
|
export type ParserOptions = {
|
|
90
|
+
/**
|
|
91
|
+
* Can be used to implement custom parser types.
|
|
92
|
+
*/
|
|
63
93
|
extraParsers?: Record<string, Parser<any>>;
|
|
64
94
|
/**
|
|
95
|
+
* Can be used to implement custom handling for unmatched arguments.
|
|
65
96
|
* @returns true if the argument was handled, false if it was not
|
|
66
97
|
*/
|
|
67
98
|
unmatchedParser?: (arg: string, tokens: string[], parser: ArgvParser) => boolean;
|
|
68
99
|
};
|
|
100
|
+
/**
|
|
101
|
+
* The main parser class. This class is used to configure and parse arguments.
|
|
102
|
+
*
|
|
103
|
+
* {@link parser} is a small helper function to create a new parser instance.
|
|
104
|
+
*/
|
|
69
105
|
export declare class ArgvParser<TArgs extends ParsedArgs = {
|
|
70
106
|
unmatched: string[];
|
|
71
107
|
}> {
|
|
108
|
+
/**
|
|
109
|
+
* The configured options for the parser.
|
|
110
|
+
*/
|
|
72
111
|
configuredOptions: {
|
|
73
112
|
[key in keyof TArgs]: InternalOptionConfig;
|
|
74
113
|
};
|
|
114
|
+
/**
|
|
115
|
+
* The configured positional arguments for the parser
|
|
116
|
+
*/
|
|
75
117
|
configuredPositionals: InternalOptionConfig[];
|
|
118
|
+
/**
|
|
119
|
+
* The configuration for the parser itself
|
|
120
|
+
*/
|
|
76
121
|
options: Required<ParserOptions>;
|
|
122
|
+
/**
|
|
123
|
+
* The parsers used to parse individual option types.
|
|
124
|
+
*/
|
|
77
125
|
parserMap: Record<string, Parser<any>>;
|
|
126
|
+
/**
|
|
127
|
+
* Creates a new parser. Normally using {@link parser} is preferred.
|
|
128
|
+
* @param options
|
|
129
|
+
*/
|
|
78
130
|
constructor(options?: ParserOptions);
|
|
131
|
+
/**
|
|
132
|
+
* Registers a new option with the parser.
|
|
133
|
+
* @param name The name of the option
|
|
134
|
+
* @param config The configuration for the option. See {@link OptionConfig}
|
|
135
|
+
* @returns Updated parser instance with the new option registered.
|
|
136
|
+
*/
|
|
79
137
|
option<TOption extends string, TOptionConfig extends OptionConfig>(name: TOption, config: TOptionConfig): ArgvParser<TArgs & { [key in TOption]: TOptionConfig["coerce"] extends (s: any) => any ? ReturnType<TOptionConfig["coerce"]> : {
|
|
80
138
|
string: string;
|
|
81
139
|
number: number;
|
|
82
140
|
boolean: boolean;
|
|
83
141
|
array: (TOptionConfig extends ArrayOptionConfig ? TOptionConfig["items"] extends "string" ? string : number : never)[];
|
|
84
142
|
}[TOptionConfig["type"]]; }>;
|
|
143
|
+
/**
|
|
144
|
+
* Registers a new positional argument with the parser.
|
|
145
|
+
* @param name The name of the positional argument
|
|
146
|
+
* @param config The configuration for the positional argument. See {@link OptionConfig}
|
|
147
|
+
* @returns Updated parser instance with the new positional argument registered.
|
|
148
|
+
*/
|
|
85
149
|
positional<TOption extends string>(name: TOption, config: OptionConfig): ArgvParser<TArgs & { [key in TOption]: string | number | boolean | (string | number)[]; }>;
|
|
150
|
+
/**
|
|
151
|
+
* Parses an array of arguments into a structured object.
|
|
152
|
+
* @param argv The array of arguments to parse
|
|
153
|
+
* @returns The parsed arguments
|
|
154
|
+
*/
|
|
86
155
|
parse(argv: string[]): TArgs;
|
|
156
|
+
/**
|
|
157
|
+
* Used to combine two parsers into a single parser.
|
|
158
|
+
* @param parser The parser to augment the current parser with.
|
|
159
|
+
* @returns The updated parser instance.
|
|
160
|
+
*/
|
|
87
161
|
augment<TAugment extends ParsedArgs>(parser: ArgvParser<TAugment>): ArgvParser<TArgs & TAugment>;
|
|
88
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Small helper function to create a new parser instance.
|
|
165
|
+
* @param opts see {@link ParserOptions}
|
|
166
|
+
* @returns new parser, see {@link ArgvParser}
|
|
167
|
+
*/
|
|
89
168
|
export declare function parser(opts?: ParserOptions): ArgvParser<{
|
|
90
169
|
unmatched: string[];
|
|
91
170
|
}>;
|
package/src/lib/parser.js
CHANGED
|
@@ -2,15 +2,36 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NoValueError = exports.ArgvParser = void 0;
|
|
4
4
|
exports.parser = parser;
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
/**
|
|
7
|
+
* The main parser class. This class is used to configure and parse arguments.
|
|
8
|
+
*
|
|
9
|
+
* {@link parser} is a small helper function to create a new parser instance.
|
|
10
|
+
*/
|
|
5
11
|
class ArgvParser {
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new parser. Normally using {@link parser} is preferred.
|
|
14
|
+
* @param options
|
|
15
|
+
*/
|
|
6
16
|
constructor(options) {
|
|
7
17
|
this.configuredOptions = {};
|
|
8
18
|
this.configuredPositionals = [];
|
|
9
19
|
this.options = Object.assign({ extraParsers: {}, unmatchedParser: () => false }, options);
|
|
10
20
|
this.parserMap = Object.assign(Object.assign({}, parserMap), this.options.extraParsers);
|
|
11
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Registers a new option with the parser.
|
|
24
|
+
* @param name The name of the option
|
|
25
|
+
* @param config The configuration for the option. See {@link OptionConfig}
|
|
26
|
+
* @returns Updated parser instance with the new option registered.
|
|
27
|
+
*/
|
|
12
28
|
option(name, config) {
|
|
29
|
+
var _a;
|
|
13
30
|
const thisAsNewType = this;
|
|
31
|
+
if (name.includes('-')) {
|
|
32
|
+
(_a = config.alias) !== null && _a !== void 0 ? _a : (config.alias = []);
|
|
33
|
+
config.alias.push((0, utils_1.fromDashedToCamelCase)(name));
|
|
34
|
+
}
|
|
14
35
|
if (config.positional) {
|
|
15
36
|
thisAsNewType.configuredPositionals.push(Object.assign({ key: name }, config));
|
|
16
37
|
}
|
|
@@ -19,9 +40,20 @@ class ArgvParser {
|
|
|
19
40
|
}
|
|
20
41
|
return this;
|
|
21
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Registers a new positional argument with the parser.
|
|
45
|
+
* @param name The name of the positional argument
|
|
46
|
+
* @param config The configuration for the positional argument. See {@link OptionConfig}
|
|
47
|
+
* @returns Updated parser instance with the new positional argument registered.
|
|
48
|
+
*/
|
|
22
49
|
positional(name, config) {
|
|
23
50
|
return this.option(name, Object.assign(Object.assign({}, config), { positional: true }));
|
|
24
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Parses an array of arguments into a structured object.
|
|
54
|
+
* @param argv The array of arguments to parse
|
|
55
|
+
* @returns The parsed arguments
|
|
56
|
+
*/
|
|
25
57
|
parse(argv) {
|
|
26
58
|
var _a, _b;
|
|
27
59
|
var _c, _d;
|
|
@@ -38,7 +70,8 @@ class ArgvParser {
|
|
|
38
70
|
}
|
|
39
71
|
// Found a flag + value
|
|
40
72
|
if (isFlag(arg)) {
|
|
41
|
-
const
|
|
73
|
+
const [maybeArg, maybeValue] = arg.split('=');
|
|
74
|
+
const keys = readArgKeys(maybeArg);
|
|
42
75
|
const configuredKeys = keys.map((key) => getConfiguredOptionKey(key, this.configuredOptions));
|
|
43
76
|
// Handles unmatched flags
|
|
44
77
|
if (configuredKeys.some((key) => key === undefined)) {
|
|
@@ -56,6 +89,9 @@ class ArgvParser {
|
|
|
56
89
|
arg = next;
|
|
57
90
|
continue;
|
|
58
91
|
}
|
|
92
|
+
if (maybeValue) {
|
|
93
|
+
argvClone.unshift(maybeValue);
|
|
94
|
+
}
|
|
59
95
|
for (const configuredKey of configuredKeys) {
|
|
60
96
|
if (configuredKey) {
|
|
61
97
|
const configuration = this.configuredOptions[configuredKey];
|
|
@@ -98,6 +134,11 @@ class ArgvParser {
|
|
|
98
134
|
}
|
|
99
135
|
return result;
|
|
100
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Used to combine two parsers into a single parser.
|
|
139
|
+
* @param parser The parser to augment the current parser with.
|
|
140
|
+
* @returns The updated parser instance.
|
|
141
|
+
*/
|
|
101
142
|
augment(parser) {
|
|
102
143
|
const thisAsNewType = this;
|
|
103
144
|
thisAsNewType.configuredOptions = Object.assign(Object.assign({}, this.configuredOptions), parser.configuredOptions);
|
|
@@ -109,6 +150,11 @@ class ArgvParser {
|
|
|
109
150
|
}
|
|
110
151
|
}
|
|
111
152
|
exports.ArgvParser = ArgvParser;
|
|
153
|
+
/**
|
|
154
|
+
* Small helper function to create a new parser instance.
|
|
155
|
+
* @param opts see {@link ParserOptions}
|
|
156
|
+
* @returns new parser, see {@link ArgvParser}
|
|
157
|
+
*/
|
|
112
158
|
function parser(opts) {
|
|
113
159
|
return new ArgvParser(opts);
|
|
114
160
|
}
|
|
@@ -190,7 +236,7 @@ const quotePairs = {
|
|
|
190
236
|
'`': '`',
|
|
191
237
|
};
|
|
192
238
|
const csvParser = (str) => {
|
|
193
|
-
|
|
239
|
+
const collected = [];
|
|
194
240
|
let val = '';
|
|
195
241
|
let inQuote = false;
|
|
196
242
|
for (const char of str) {
|
|
@@ -269,6 +315,10 @@ function isFlag(str) {
|
|
|
269
315
|
function readArgKeys(str) {
|
|
270
316
|
// Long flags (e.g. --foo)
|
|
271
317
|
if (str.startsWith('--')) {
|
|
318
|
+
const key = str.slice(2);
|
|
319
|
+
if (key.includes('-')) {
|
|
320
|
+
return [(0, utils_1.fromDashedToCamelCase)(key)];
|
|
321
|
+
}
|
|
272
322
|
return [str.slice(2)];
|
|
273
323
|
// Short flag combinations (e.g. -xvf)
|
|
274
324
|
}
|
package/src/lib/parser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../../packages/parser/src/lib/parser.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../../packages/parser/src/lib/parser.ts"],"names":[],"mappings":";;;AAyWA,wBAEC;AA3WD,mCAAgD;AAmIhD;;;;GAIG;AACH,MAAa,UAAU;IAyBrB;;;OAGG;IACH,YAAY,OAAuB;QACjC,IAAI,CAAC,iBAAiB,GAAG,EAA+C,CAAC;QACzE,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAC;QAChC,IAAI,CAAC,OAAO,mBACV,YAAY,EAAE,EAAE,EAChB,eAAe,EAAE,GAAG,EAAE,CAAC,KAAK,IACzB,OAAO,CACX,CAAC;QACF,IAAI,CAAC,SAAS,mCACT,SAAS,GACT,IAAI,CAAC,OAAO,CAAC,YAAY,CAC7B,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,MAAM,CACJ,IAAa,EACb,MAAqB;;QAErB,MAAM,aAAa,GAAG,IAErB,CAAC;QAEF,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,MAAA,MAAM,CAAC,KAAK,oCAAZ,MAAM,CAAC,KAAK,GAAK,EAAE,EAAC;YACpB,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAA,6BAAqB,EAAC,IAAI,CAAC,CAAC,CAAC;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,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACzB,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACtB,OAAO,CAAC,IAAA,6BAAqB,EAAC,GAAG,CAAC,CAAC,CAAC;QACtC,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACtB,sCAAsC;IACxC,CAAC;SAAM,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,gBAAgB,GAAG,EAAE,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function fromDashedToCamelCase(str: string): string;
|
package/src/lib/utils.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fromDashedToCamelCase = fromDashedToCamelCase;
|
|
4
|
+
function fromDashedToCamelCase(str) {
|
|
5
|
+
return str.replace(/-([a-z])/g, (match, letter) => letter.toUpperCase());
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../packages/parser/src/lib/utils.ts"],"names":[],"mappings":";;AAAA,sDAEC;AAFD,SAAgB,qBAAqB,CAAC,GAAW;IAC/C,OAAO,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;AAC3E,CAAC"}
|