@cli-forge/parser 0.1.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/README.md +11 -0
- package/package.json +11 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +5 -0
- package/src/index.js.map +1 -0
- package/src/lib/parser.d.ts +96 -0
- package/src/lib/parser.js +280 -0
- package/src/lib/parser.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/parser';
|
package/src/index.js
ADDED
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/parser/src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
export type CommonOptionConfig<T, TCoerce = T> = {
|
|
2
|
+
/**
|
|
3
|
+
* If set to true, the option will be treated as a positional argument.
|
|
4
|
+
*/
|
|
5
|
+
positional?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Provide an array of aliases for the option.
|
|
8
|
+
*/
|
|
9
|
+
alias?: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Provide a default value for the option.
|
|
12
|
+
*/
|
|
13
|
+
default?: T;
|
|
14
|
+
/**
|
|
15
|
+
* Provide a description for the option.
|
|
16
|
+
*/
|
|
17
|
+
description?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Provide a function to coerce the value of the option.
|
|
20
|
+
* @param value Value of the option
|
|
21
|
+
* @returns Coerced value of the option
|
|
22
|
+
*/
|
|
23
|
+
coerce?: (value: T) => TCoerce;
|
|
24
|
+
/**
|
|
25
|
+
* Provide a function to validate the value of the option.
|
|
26
|
+
* @param value Coerced value of the option
|
|
27
|
+
* @returns If the value is valid, return true. If the value is invalid, return false or a string with an error message.
|
|
28
|
+
*/
|
|
29
|
+
validate?: (value: TCoerce) => boolean | string;
|
|
30
|
+
/**
|
|
31
|
+
* If true, the option is required.
|
|
32
|
+
*/
|
|
33
|
+
required?: boolean;
|
|
34
|
+
};
|
|
35
|
+
export type StringOptionConfig<TCoerce = string> = {
|
|
36
|
+
type: 'string';
|
|
37
|
+
} & CommonOptionConfig<string, TCoerce>;
|
|
38
|
+
export type NumberOptionConfig<TCoerce = number> = {
|
|
39
|
+
type: 'number';
|
|
40
|
+
} & CommonOptionConfig<number, TCoerce>;
|
|
41
|
+
export type BooleanOptionConfig<TCoerce = boolean> = {
|
|
42
|
+
type: 'boolean';
|
|
43
|
+
} & CommonOptionConfig<boolean, TCoerce>;
|
|
44
|
+
export type StringArrayOptionConfig<TCoerce = string> = {
|
|
45
|
+
type: 'array';
|
|
46
|
+
items: 'string';
|
|
47
|
+
} & CommonOptionConfig<string[], TCoerce>;
|
|
48
|
+
export type NumberArrayOptionConfig<TCoerce = number> = {
|
|
49
|
+
type: 'array';
|
|
50
|
+
items: 'number';
|
|
51
|
+
} & CommonOptionConfig<number[], TCoerce>;
|
|
52
|
+
export type ArrayOptionConfig<TCoerce = string | number> = StringArrayOptionConfig<TCoerce> | NumberArrayOptionConfig<TCoerce>;
|
|
53
|
+
export type OptionConfig<TCoerce = any> = StringOptionConfig<TCoerce> | NumberOptionConfig<TCoerce> | ArrayOptionConfig<TCoerce> | BooleanOptionConfig<TCoerce>;
|
|
54
|
+
type InternalOptionConfig = OptionConfig & {
|
|
55
|
+
key: string;
|
|
56
|
+
position?: number;
|
|
57
|
+
};
|
|
58
|
+
export type ParsedArgs = {
|
|
59
|
+
unmatched: string[];
|
|
60
|
+
'--'?: string[];
|
|
61
|
+
};
|
|
62
|
+
export type ParserOptions = {
|
|
63
|
+
extraParsers?: Record<string, Parser<any>>;
|
|
64
|
+
/**
|
|
65
|
+
* @returns true if the argument was handled, false if it was not
|
|
66
|
+
*/
|
|
67
|
+
unmatchedParser?: (arg: string, tokens: string[], parser: ArgvParser) => boolean;
|
|
68
|
+
};
|
|
69
|
+
export declare class ArgvParser<TArgs extends ParsedArgs = {
|
|
70
|
+
unmatched: string[];
|
|
71
|
+
}> {
|
|
72
|
+
configuredOptions: {
|
|
73
|
+
[key in keyof TArgs]: InternalOptionConfig;
|
|
74
|
+
};
|
|
75
|
+
configuredPositionals: InternalOptionConfig[];
|
|
76
|
+
options: Required<ParserOptions>;
|
|
77
|
+
parserMap: Record<string, Parser<any>>;
|
|
78
|
+
constructor(options?: ParserOptions);
|
|
79
|
+
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
|
+
string: string;
|
|
81
|
+
number: number;
|
|
82
|
+
boolean: boolean;
|
|
83
|
+
array: (TOptionConfig extends ArrayOptionConfig ? TOptionConfig["items"] extends "string" ? string : number : never)[];
|
|
84
|
+
}[TOptionConfig["type"]]; }>;
|
|
85
|
+
positional<TOption extends string>(name: TOption, config: OptionConfig): ArgvParser<TArgs & { [key in TOption]: string | number | boolean | (string | number)[]; }>;
|
|
86
|
+
parse(argv: string[]): TArgs;
|
|
87
|
+
augment<TAugment extends ParsedArgs>(parser: ArgvParser<TAugment>): ArgvParser<TArgs & TAugment>;
|
|
88
|
+
}
|
|
89
|
+
export declare function parser(opts?: ParserOptions): ArgvParser<{
|
|
90
|
+
unmatched: string[];
|
|
91
|
+
}>;
|
|
92
|
+
export declare class NoValueError extends Error {
|
|
93
|
+
constructor();
|
|
94
|
+
}
|
|
95
|
+
type Parser<TConfig extends OptionConfig, T = any> = (config: TConfig, tokens: string[], current?: T) => T;
|
|
96
|
+
export {};
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoValueError = exports.ArgvParser = void 0;
|
|
4
|
+
exports.parser = parser;
|
|
5
|
+
class ArgvParser {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
this.configuredOptions = {};
|
|
8
|
+
this.configuredPositionals = [];
|
|
9
|
+
this.options = Object.assign({ extraParsers: {}, unmatchedParser: () => false }, options);
|
|
10
|
+
this.parserMap = Object.assign(Object.assign({}, parserMap), this.options.extraParsers);
|
|
11
|
+
}
|
|
12
|
+
option(name, config) {
|
|
13
|
+
const thisAsNewType = this;
|
|
14
|
+
if (config.positional) {
|
|
15
|
+
thisAsNewType.configuredPositionals.push(Object.assign({ key: name }, config));
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
thisAsNewType.configuredOptions[name] = Object.assign({ key: name }, config);
|
|
19
|
+
}
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
positional(name, config) {
|
|
23
|
+
return this.option(name, Object.assign(Object.assign({}, config), { positional: true }));
|
|
24
|
+
}
|
|
25
|
+
parse(argv) {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
var _c, _d;
|
|
28
|
+
const argvClone = [...argv];
|
|
29
|
+
const result = {
|
|
30
|
+
unmatched: [],
|
|
31
|
+
};
|
|
32
|
+
let arg = argvClone.shift();
|
|
33
|
+
let matchedPositionals = 0;
|
|
34
|
+
while (arg) {
|
|
35
|
+
if (arg === '--') {
|
|
36
|
+
result['--'] = argvClone;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
// Found a flag + value
|
|
40
|
+
if (isFlag(arg)) {
|
|
41
|
+
const keys = readArgKeys(arg);
|
|
42
|
+
const configuredKeys = keys.map((key) => getConfiguredOptionKey(key, this.configuredOptions));
|
|
43
|
+
// Handles unmatched flags
|
|
44
|
+
if (configuredKeys.some((key) => key === undefined)) {
|
|
45
|
+
if (this.options.unmatchedParser(arg, argvClone, this)) {
|
|
46
|
+
arg = argvClone.shift();
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
result.unmatched.push(arg);
|
|
50
|
+
let next = argvClone.shift();
|
|
51
|
+
// Collect all the values until the next flag
|
|
52
|
+
while (next && !isNextFlag(next)) {
|
|
53
|
+
result.unmatched.push(next);
|
|
54
|
+
next = argvClone.shift();
|
|
55
|
+
}
|
|
56
|
+
arg = next;
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
for (const configuredKey of configuredKeys) {
|
|
60
|
+
if (configuredKey) {
|
|
61
|
+
const configuration = this.configuredOptions[configuredKey];
|
|
62
|
+
const value = tryParseValue(this.parserMap[configuration.type], configuration, argvClone, result[configuration.key]);
|
|
63
|
+
result[configuration.key] = value;
|
|
64
|
+
arg = argvClone.shift();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// Found a positional argument
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
const configuration = this.configuredPositionals[matchedPositionals];
|
|
71
|
+
if (configuration && configuration.positional === true) {
|
|
72
|
+
const value = tryParseValue(this.parserMap[configuration.type], configuration, [arg], result[configuration.key]);
|
|
73
|
+
result[configuration.key] = value;
|
|
74
|
+
matchedPositionals++;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
if (this.options.unmatchedParser(arg, argvClone, this)) {
|
|
78
|
+
arg = argvClone.shift();
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
result.unmatched.push(arg);
|
|
82
|
+
}
|
|
83
|
+
arg = argvClone.shift();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
for (const configurationKey in this.configuredOptions) {
|
|
87
|
+
const configuration = this.configuredOptions[configurationKey];
|
|
88
|
+
if (configuration.default !== undefined) {
|
|
89
|
+
(_a = result[_c = configuration.key]) !== null && _a !== void 0 ? _a : (result[_c] = configuration.default);
|
|
90
|
+
}
|
|
91
|
+
validateOption(configuration, result[configuration.key]);
|
|
92
|
+
}
|
|
93
|
+
for (const configuration of this.configuredPositionals) {
|
|
94
|
+
if (configuration.default !== undefined) {
|
|
95
|
+
(_b = result[_d = configuration.key]) !== null && _b !== void 0 ? _b : (result[_d] = configuration.default);
|
|
96
|
+
}
|
|
97
|
+
validateOption(configuration, result[configuration.key]);
|
|
98
|
+
}
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
augment(parser) {
|
|
102
|
+
const thisAsNewType = this;
|
|
103
|
+
thisAsNewType.configuredOptions = Object.assign(Object.assign({}, this.configuredOptions), parser.configuredOptions);
|
|
104
|
+
thisAsNewType.configuredPositionals = [
|
|
105
|
+
...this.configuredPositionals,
|
|
106
|
+
...parser.configuredPositionals,
|
|
107
|
+
];
|
|
108
|
+
return thisAsNewType;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.ArgvParser = ArgvParser;
|
|
112
|
+
function parser(opts) {
|
|
113
|
+
return new ArgvParser(opts);
|
|
114
|
+
}
|
|
115
|
+
function validateOption(optionConfig, value) {
|
|
116
|
+
if (optionConfig.validate) {
|
|
117
|
+
const result = optionConfig.validate(value);
|
|
118
|
+
if (typeof result === 'string') {
|
|
119
|
+
throw new Error(result);
|
|
120
|
+
}
|
|
121
|
+
if (!result) {
|
|
122
|
+
throw new Error(`Invalid value for${optionConfig.positional ? ' positional' : ''} option ${optionConfig.key}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (optionConfig.required && value === undefined) {
|
|
126
|
+
throw new Error(`Missing required${optionConfig.positional ? ' positional' : ''} option ${optionConfig.key}`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function getConfiguredOptionKey(key, configuredOptions) {
|
|
130
|
+
var _a;
|
|
131
|
+
if (key in configuredOptions) {
|
|
132
|
+
return key;
|
|
133
|
+
}
|
|
134
|
+
for (const configuredKey in configuredOptions) {
|
|
135
|
+
const config = configuredOptions[configuredKey];
|
|
136
|
+
if ((_a = config === null || config === void 0 ? void 0 : config.alias) === null || _a === void 0 ? void 0 : _a.includes(key)) {
|
|
137
|
+
return configuredKey;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
function isNextFlag(str) {
|
|
143
|
+
return str.startsWith('--' || str.startsWith('-'));
|
|
144
|
+
}
|
|
145
|
+
const booleanParser = (_, tokens) => {
|
|
146
|
+
const val = tokens.shift();
|
|
147
|
+
if (val === undefined) {
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
if (isNextFlag(val)) {
|
|
151
|
+
tokens.unshift(val);
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
if (val === 'false') {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
return true;
|
|
158
|
+
};
|
|
159
|
+
class NoValueError extends Error {
|
|
160
|
+
constructor() {
|
|
161
|
+
super('Expected a value');
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
exports.NoValueError = NoValueError;
|
|
165
|
+
const stringParser = (cfg, tokens) => {
|
|
166
|
+
const val = tokens.shift();
|
|
167
|
+
if (val === undefined) {
|
|
168
|
+
throw new NoValueError();
|
|
169
|
+
}
|
|
170
|
+
if (isNextFlag(val)) {
|
|
171
|
+
tokens.unshift(val);
|
|
172
|
+
throw new NoValueError();
|
|
173
|
+
}
|
|
174
|
+
return val;
|
|
175
|
+
};
|
|
176
|
+
const numberParser = (_, tokens) => {
|
|
177
|
+
const val = tokens.shift();
|
|
178
|
+
if (val === undefined) {
|
|
179
|
+
throw new NoValueError();
|
|
180
|
+
}
|
|
181
|
+
if (isNextFlag(val)) {
|
|
182
|
+
tokens.unshift(val);
|
|
183
|
+
throw new NoValueError();
|
|
184
|
+
}
|
|
185
|
+
return Number(val);
|
|
186
|
+
};
|
|
187
|
+
const quotePairs = {
|
|
188
|
+
'"': '"',
|
|
189
|
+
"'": "'",
|
|
190
|
+
'`': '`',
|
|
191
|
+
};
|
|
192
|
+
const csvParser = (str) => {
|
|
193
|
+
let collected = [];
|
|
194
|
+
let val = '';
|
|
195
|
+
let inQuote = false;
|
|
196
|
+
for (const char of str) {
|
|
197
|
+
if (inQuote) {
|
|
198
|
+
if (char === quotePairs[inQuote]) {
|
|
199
|
+
inQuote = false;
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
val += char;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
if (char in quotePairs) {
|
|
207
|
+
inQuote = char;
|
|
208
|
+
}
|
|
209
|
+
else if (char === ',') {
|
|
210
|
+
collected.push(val);
|
|
211
|
+
val = '';
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
val += char;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
collected.push(val);
|
|
219
|
+
return collected;
|
|
220
|
+
};
|
|
221
|
+
const arrayParser = (config, tokens, current) => {
|
|
222
|
+
const coerce = config.items === 'string'
|
|
223
|
+
? (s) => s
|
|
224
|
+
: (s) => Number(s);
|
|
225
|
+
let val = tokens.shift();
|
|
226
|
+
if (val && val.includes(',')) {
|
|
227
|
+
return csvParser(val).map(coerce);
|
|
228
|
+
}
|
|
229
|
+
const collected = [];
|
|
230
|
+
while (val) {
|
|
231
|
+
if (isNextFlag(val)) {
|
|
232
|
+
tokens.unshift(val);
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
collected.push(val);
|
|
236
|
+
val = tokens.shift();
|
|
237
|
+
}
|
|
238
|
+
const coerced = collected.map(coerce);
|
|
239
|
+
return current ? current.concat(coerced) : coerced;
|
|
240
|
+
};
|
|
241
|
+
function tryParseValue(parser, config, tokens, current) {
|
|
242
|
+
var _a, _b;
|
|
243
|
+
if (!parser) {
|
|
244
|
+
throw new Error(`No parser found for option ${config.key} with type ${config.type}`);
|
|
245
|
+
}
|
|
246
|
+
try {
|
|
247
|
+
const val = parser(config, tokens, current);
|
|
248
|
+
return (_b = (_a = config.coerce) === null || _a === void 0 ? void 0 : _a.call(config, val)) !== null && _b !== void 0 ? _b : val;
|
|
249
|
+
}
|
|
250
|
+
catch (e) {
|
|
251
|
+
if (e instanceof NoValueError) {
|
|
252
|
+
if (config.default !== undefined) {
|
|
253
|
+
return config.default;
|
|
254
|
+
}
|
|
255
|
+
throw new Error(`Expected a value for ${config.key}`);
|
|
256
|
+
}
|
|
257
|
+
throw e;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
const parserMap = {
|
|
261
|
+
string: stringParser,
|
|
262
|
+
number: numberParser,
|
|
263
|
+
boolean: booleanParser,
|
|
264
|
+
array: arrayParser,
|
|
265
|
+
};
|
|
266
|
+
function isFlag(str) {
|
|
267
|
+
return str.startsWith('-');
|
|
268
|
+
}
|
|
269
|
+
function readArgKeys(str) {
|
|
270
|
+
// Long flags (e.g. --foo)
|
|
271
|
+
if (str.startsWith('--')) {
|
|
272
|
+
return [str.slice(2)];
|
|
273
|
+
// Short flag combinations (e.g. -xvf)
|
|
274
|
+
}
|
|
275
|
+
else if (str.startsWith('-')) {
|
|
276
|
+
return str.slice(1).split('');
|
|
277
|
+
}
|
|
278
|
+
throw new Error(`Invalid flag ${str}`);
|
|
279
|
+
}
|
|
280
|
+
//# sourceMappingURL=parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../../packages/parser/src/lib/parser.ts"],"names":[],"mappings":";;;AAyQA,wBAEC;AA5KD,MAAa,UAAU;IAUrB,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,MAAM,CACJ,IAAa,EACb,MAAqB;QAErB,MAAM,aAAa,GAAG,IAErB,CAAC;QAEF,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YACtB,aAAa,CAAC,qBAAqB,CAAC,IAAI,i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