massarg 1.0.7-pre.1 → 2.0.0-pre.10

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/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,gDAAyB;AACzB,uDAAgC;AAChC,+DAAwC;AACxC,8CAAuB;AAEvB,iCAA4E;AAC5E,mCAAwC;AACxC,2CAAiG;AAEjG;IAiCE;QA/BQ,aAAQ,GAA8B,EAAE,CAAA;QACxC,cAAS,GAA0B,EAAE,CAAA;QAErC,cAAS,GAAiB,EAAE,CAAA;QAC5B,gBAAW,GAAG,CAAC,CAAA;QACvB;;gDAEwC;QACjC,SAAI,GAA0B,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAc,EAA2B,CAAA;QAE7F,UAAK,GAAsB;YACjC,OAAO,EAAE,SAAgB;YACzB,YAAY,EAAE,KAAK;YACnB,eAAe,EAAE,QAAQ;YACzB,WAAW,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;YAC9B,cAAc,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;YAC/B,UAAU,EAAE,OAAO;YACnB,UAAU,EAAE,EAAE;YACd,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,EAAE;YACV,oBAAoB,EAAE,KAAK;YAC3B,mBAAmB,EAAE,GAAG;YACxB,gBAAgB,EAAE,IAAI;YACtB,YAAY,EAAE,qBAAqB;YACnC,SAAS,EAAE,IAAI;YACf,eAAe,EAAE,IAAI;YACrB,kBAAkB,EAAE,GAAG;YACvB,mBAAmB,EAAE,GAAG;SACzB,CAAA;QACO,qBAAgB,GAAoD,EAAE,CAAA;QAG5E,IAAI,CAAC,MAAM,CAAC;YACV,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,CAAC,GAAG,CAA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UAAc,KAAkC;;QAAE,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,6BAAc;;QAC9D,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;YACzB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;SACtB;QACD,IAAI,MAAM,GAAW,SAAgB,CAAA;;YACrC,KAAgB,IAAA,KAAA,SAAA,IAAA,eAAO,EAAC,KAAK,CAAC,CAAA,gBAAA,4BAAE;gBAA3B,IAAM,CAAC,WAAA;gBACV,MAAM,GAAI,eAAK,CAAC,CAAuB,CAAC,OAA9B,eAAK,2BAAkD,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAC,CAAA;aAC7F;;;;;;;;;QACD,OAAO,eAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC5B,CAAC;IAEO,4BAAU,GAAlB;QAAmB,gBAAgB;aAAhB,UAAgB,EAAhB,qBAAgB,EAAhB,IAAgB;YAAhB,2BAAgB;;QACjC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;YACzB,OAAO,CAAC,CAAA;SACT;QACD,OAAO,kBAAU,wCAAI,MAAM,WAAC;IAC9B,CAAC;IACH,cAAC;AAAD,CAAC,AAxiBD,IAwiBC;AAxiBY,0BAAO;AA0iBpB,SAAgB,OAAO;IACrB,OAAO,IAAI,OAAO,EAAK,CAAA;AACzB,CAAC;AAFD,0BAEC;AAED,kBAAe,OAAO,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB"}
package/massarg.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { ArgsObject, CommandConfig, MassargCommand } from './command';
2
+ type MinimalCommandConfig<Args extends ArgsObject = ArgsObject> = Omit<CommandConfig<Args>, 'aliases' | 'run'> & Partial<Pick<CommandConfig<Args>, 'aliases' | 'run'>>;
3
+ export declare class Massarg<Args extends ArgsObject = ArgsObject> extends MassargCommand<Args> {
4
+ constructor(options: MinimalCommandConfig<Args>);
5
+ }
6
+ export declare function massarg<Args extends ArgsObject = ArgsObject>(options: MinimalCommandConfig<Args>): MassargCommand<Args>;
7
+ export {};
8
+ //# sourceMappingURL=massarg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"massarg.d.ts","sourceRoot":"","sources":["../src/massarg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAErE,KAAK,oBAAoB,CAAC,IAAI,SAAS,UAAU,GAAG,UAAU,IAAI,IAAI,CACpE,aAAa,CAAC,IAAI,CAAC,EACnB,SAAS,GAAG,KAAK,CAClB,GACC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,KAAK,CAAC,CAAC,CAAA;AAEvD,qBAAa,OAAO,CAAC,IAAI,SAAS,UAAU,GAAG,UAAU,CAAE,SAAQ,cAAc,CAAC,IAAI,CAAC;gBACzE,OAAO,EAAE,oBAAoB,CAAC,IAAI,CAAC;CAWhD;AAED,wBAAgB,OAAO,CAAC,IAAI,SAAS,UAAU,GAAG,UAAU,EAC1D,OAAO,EAAE,oBAAoB,CAAC,IAAI,CAAC,GAClC,cAAc,CAAC,IAAI,CAAC,CAEtB"}
package/massarg.js ADDED
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.massarg = exports.Massarg = void 0;
4
+ const command_1 = require("./command");
5
+ class Massarg extends command_1.MassargCommand {
6
+ constructor(options) {
7
+ // TODO consider re-using name and description for general help, and pass them to super
8
+ super({
9
+ aliases: [],
10
+ run: () => {
11
+ console.log(this.helpString());
12
+ // throw new Error("No main command provided")
13
+ },
14
+ ...options,
15
+ });
16
+ }
17
+ }
18
+ exports.Massarg = Massarg;
19
+ function massarg(options) {
20
+ return new Massarg(options);
21
+ }
22
+ exports.massarg = massarg;
23
+ //# sourceMappingURL=massarg.js.map
package/massarg.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"massarg.js","sourceRoot":"","sources":["../src/massarg.ts"],"names":[],"mappings":";;;AAAA,uCAAqE;AAQrE,MAAa,OAA8C,SAAQ,wBAAoB;IACrF,YAAY,OAAmC;QAC7C,uFAAuF;QACvF,KAAK,CAAC;YACJ,OAAO,EAAE,EAAE;YACX,GAAG,EAAE,GAAG,EAAE;gBACR,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAA;gBAC9B,8CAA8C;YAChD,CAAC;YACD,GAAG,OAAO;SACX,CAAC,CAAA;IACJ,CAAC;CACF;AAZD,0BAYC;AAED,SAAgB,OAAO,CACrB,OAAmC;IAEnC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;AAC7B,CAAC;AAJD,0BAIC"}
package/option.d.ts ADDED
@@ -0,0 +1,293 @@
1
+ import { z } from 'zod';
2
+ import { ArgsObject } from './command';
3
+ export declare const OptionConfig: <OptionType, Args extends ArgsObject = ArgsObject>(type: z.ZodType<OptionType, z.ZodTypeDef, OptionType>) => z.ZodObject<{
4
+ /** Name of the option */
5
+ name: z.ZodString;
6
+ /** Description of the option, displayed in the help output */
7
+ description: z.ZodString;
8
+ /** Default value of the option */
9
+ defaultValue: z.ZodOptional<z.ZodAny>;
10
+ /** Aliases for the option, which can be used with the shorthand option notation. */
11
+ aliases: z.ZodArray<z.ZodString, "many">;
12
+ /**
13
+ * Parse the value of the option. You can return any type here, or throw an error if the value
14
+ * is invalid.
15
+ */
16
+ parse: z.ZodOptional<z.ZodType<Parser<Args, OptionType>, z.ZodTypeDef, Parser<Args, OptionType>>>;
17
+ /**
18
+ * Whether the option is an array.
19
+ *
20
+ * Array options can be specified multiple times, and the values will be collected into an array.
21
+ *
22
+ * Normally, specifying an option multiple times will override the previous value.
23
+ */
24
+ array: z.ZodOptional<z.ZodBoolean>;
25
+ /** Whether the option is required. If it is required, parsing will throw an error if it's not
26
+ * present.
27
+ */
28
+ required: z.ZodOptional<z.ZodBoolean>;
29
+ /** Whether the option is the default option. The default option is the option that is used if
30
+ * no other option is specified, e.g. a value is passed in without an option name.
31
+ *
32
+ * Note that if commands match the same argument first, they will be used instead of the default
33
+ * option.
34
+ */
35
+ isDefault: z.ZodOptional<z.ZodBoolean>;
36
+ /** Whether the option is hidden. Hidden options are not displayed in the help output. */
37
+ hidden: z.ZodOptional<z.ZodBoolean>;
38
+ /** Specify a custom name for the output, which will be used when parsing the args. */
39
+ outputName: z.ZodOptional<z.ZodString>;
40
+ }, "strip", z.ZodTypeAny, {
41
+ name: string;
42
+ description: string;
43
+ aliases: string[];
44
+ defaultValue?: any;
45
+ parse?: Parser<Args, OptionType> | undefined;
46
+ array?: boolean | undefined;
47
+ required?: boolean | undefined;
48
+ isDefault?: boolean | undefined;
49
+ hidden?: boolean | undefined;
50
+ outputName?: string | undefined;
51
+ }, {
52
+ name: string;
53
+ description: string;
54
+ aliases: string[];
55
+ defaultValue?: any;
56
+ parse?: Parser<Args, OptionType> | undefined;
57
+ array?: boolean | undefined;
58
+ required?: boolean | undefined;
59
+ isDefault?: boolean | undefined;
60
+ hidden?: boolean | undefined;
61
+ outputName?: string | undefined;
62
+ }>;
63
+ export type OptionConfig<T = unknown, Args extends ArgsObject = ArgsObject> = z.infer<ReturnType<typeof OptionConfig<T, Args>>>;
64
+ export declare const FlagConfig: z.ZodObject<{
65
+ name: z.ZodString;
66
+ description: z.ZodString;
67
+ defaultValue: z.ZodOptional<z.ZodAny>;
68
+ aliases: z.ZodArray<z.ZodString, "many">;
69
+ array: z.ZodOptional<z.ZodBoolean>;
70
+ required: z.ZodOptional<z.ZodBoolean>;
71
+ hidden: z.ZodOptional<z.ZodBoolean>;
72
+ outputName: z.ZodOptional<z.ZodString>;
73
+ negatable: z.ZodOptional<z.ZodBoolean>;
74
+ }, "strip", z.ZodTypeAny, {
75
+ name: string;
76
+ description: string;
77
+ aliases: string[];
78
+ defaultValue?: any;
79
+ array?: boolean | undefined;
80
+ required?: boolean | undefined;
81
+ hidden?: boolean | undefined;
82
+ outputName?: string | undefined;
83
+ negatable?: boolean | undefined;
84
+ }, {
85
+ name: string;
86
+ description: string;
87
+ aliases: string[];
88
+ defaultValue?: any;
89
+ array?: boolean | undefined;
90
+ required?: boolean | undefined;
91
+ hidden?: boolean | undefined;
92
+ outputName?: string | undefined;
93
+ negatable?: boolean | undefined;
94
+ }>;
95
+ export type FlagConfig = z.infer<typeof FlagConfig>;
96
+ export type Parser<Args extends ArgsObject = ArgsObject, OptionType extends any = any> = (x: string, y: Args) => OptionType;
97
+ export declare const TypedOptionConfig: <OptionType, Args extends ArgsObject = ArgsObject>(type: z.ZodType<OptionType, z.ZodTypeDef, OptionType>) => z.ZodObject<{
98
+ name: z.ZodString;
99
+ description: z.ZodString;
100
+ defaultValue: z.ZodOptional<z.ZodAny>;
101
+ aliases: z.ZodArray<z.ZodString, "many">;
102
+ array: z.ZodOptional<z.ZodBoolean>;
103
+ required: z.ZodOptional<z.ZodBoolean>;
104
+ isDefault: z.ZodOptional<z.ZodBoolean>;
105
+ hidden: z.ZodOptional<z.ZodBoolean>;
106
+ outputName: z.ZodOptional<z.ZodString>;
107
+ parse: z.ZodOptional<z.ZodType<Parser<Args, OptionType>, z.ZodTypeDef, Parser<Args, OptionType>>>;
108
+ type: z.ZodOptional<z.ZodEnum<["number"]>>;
109
+ }, "strip", z.ZodTypeAny, {
110
+ name: string;
111
+ description: string;
112
+ aliases: string[];
113
+ defaultValue?: any;
114
+ array?: boolean | undefined;
115
+ required?: boolean | undefined;
116
+ isDefault?: boolean | undefined;
117
+ hidden?: boolean | undefined;
118
+ outputName?: string | undefined;
119
+ parse?: Parser<Args, OptionType> | undefined;
120
+ type?: "number" | undefined;
121
+ }, {
122
+ name: string;
123
+ description: string;
124
+ aliases: string[];
125
+ defaultValue?: any;
126
+ array?: boolean | undefined;
127
+ required?: boolean | undefined;
128
+ isDefault?: boolean | undefined;
129
+ hidden?: boolean | undefined;
130
+ outputName?: string | undefined;
131
+ parse?: Parser<Args, OptionType> | undefined;
132
+ type?: "number" | undefined;
133
+ }>;
134
+ export type TypedOptionConfig<T, A extends ArgsObject = ArgsObject> = z.infer<ReturnType<typeof TypedOptionConfig<T, A>>>;
135
+ /**
136
+ * @see OptionConfig
137
+ * @see ArrayOptionConfig
138
+ */
139
+ export declare const ArrayOptionConfig: <T, A extends ArgsObject = ArgsObject>(type: z.ZodType<T, z.ZodTypeDef, T>) => z.ZodObject<{
140
+ type: z.ZodOptional<z.ZodEnum<["number"]>>;
141
+ name: z.ZodString;
142
+ description: z.ZodString;
143
+ aliases: z.ZodArray<z.ZodString, "many">;
144
+ array: z.ZodOptional<z.ZodBoolean>;
145
+ required: z.ZodOptional<z.ZodBoolean>;
146
+ isDefault: z.ZodOptional<z.ZodBoolean>;
147
+ hidden: z.ZodOptional<z.ZodBoolean>;
148
+ outputName: z.ZodOptional<z.ZodString>;
149
+ parse: z.ZodOptional<z.ZodType<Parser<A, T[]>, z.ZodTypeDef, Parser<A, T[]>>>;
150
+ defaultValue: z.ZodOptional<z.ZodArray<z.ZodType<T, z.ZodTypeDef, T>, "many">>;
151
+ }, "strip", z.ZodTypeAny, {
152
+ name: string;
153
+ description: string;
154
+ aliases: string[];
155
+ type?: "number" | undefined;
156
+ array?: boolean | undefined;
157
+ required?: boolean | undefined;
158
+ isDefault?: boolean | undefined;
159
+ hidden?: boolean | undefined;
160
+ outputName?: string | undefined;
161
+ parse?: Parser<A, T[]> | undefined;
162
+ defaultValue?: T[] | undefined;
163
+ }, {
164
+ name: string;
165
+ description: string;
166
+ aliases: string[];
167
+ type?: "number" | undefined;
168
+ array?: boolean | undefined;
169
+ required?: boolean | undefined;
170
+ isDefault?: boolean | undefined;
171
+ hidden?: boolean | undefined;
172
+ outputName?: string | undefined;
173
+ parse?: Parser<A, T[]> | undefined;
174
+ defaultValue?: T[] | undefined;
175
+ }>;
176
+ /**
177
+ * An option that can be passed to a command.
178
+ *
179
+ * This type represents an array option, which can be specified multiple times.
180
+ */
181
+ export type ArrayOptionConfig<T = unknown> = z.infer<ReturnType<typeof ArrayOptionConfig<z.ZodType<T>>>>;
182
+ export declare const OPT_FULL_PREFIX = "--";
183
+ export declare const OPT_SHORT_PREFIX = "-";
184
+ export declare const NEGATE_FULL_PREFIX = "--no-";
185
+ export declare const NEGATE_SHORT_PREFIX = "^";
186
+ export type Prefixes = {
187
+ optionPrefix: string;
188
+ aliasPrefix: string;
189
+ negateFlagPrefix: string;
190
+ negateAliasPrefix: string;
191
+ };
192
+ /** @internal */
193
+ export type ArgvValue<T> = {
194
+ argv: string[];
195
+ value: T;
196
+ key: string;
197
+ };
198
+ /**
199
+ * An option that can be passed to a command.
200
+ *
201
+ * Options can be specified in two ways:
202
+ *
203
+ * - Using the long form, e.g. `--option value`
204
+ * - Using the short form, e.g. `-o value`
205
+ *
206
+ * They can also have a parse function, which will be used to parse the value passed in from the
207
+ * original argument (string).
208
+ *
209
+ * @example
210
+ * ```ts
211
+ * massarg(options).option({
212
+ * name: 'option',
213
+ * description: 'An option',
214
+ * defaultValue: 'default',
215
+ * aliases: ['o'],
216
+ * parse: (value) => value.toUpperCase(),
217
+ * })
218
+ * ```
219
+ */
220
+ export declare class MassargOption<OptionType extends any = unknown, Args extends ArgsObject = ArgsObject> implements OptionConfig<OptionType, Args> {
221
+ name: string;
222
+ description: string;
223
+ defaultValue?: OptionType;
224
+ aliases: string[];
225
+ parse: Parser<Args, OptionType>;
226
+ isArray: boolean;
227
+ isRequired: boolean;
228
+ isDefault: boolean;
229
+ outputName?: string;
230
+ constructor(options: OptionConfig<OptionType, Args>);
231
+ static fromTypedConfig<T = unknown, A extends ArgsObject = ArgsObject>(config: TypedOptionConfig<T, A>): MassargOption<T>;
232
+ getOutputName(): string;
233
+ parseDetails(argv: string[], options: ArgsObject, prefixes: Prefixes): ArgvValue<OptionType>;
234
+ helpString(): string;
235
+ /** Returns true if the flag (including any prefixes) matches the name or aliases */
236
+ isMatch(arg: string, prefixes: Prefixes): boolean;
237
+ /**
238
+ * Returns the name of the flag, removing any prefixes. It is discriminate of if the option
239
+ * exists, as it is a static method; it only returns the name of the flag if it matches the
240
+ * prefixes format.
241
+ */
242
+ static findNameInArg(arg: string, prefixes: Prefixes): string;
243
+ }
244
+ /**
245
+ * An option that can be passed to a command.
246
+ *
247
+ * This type of option parses a number, and fails if it is not a valid number.
248
+ *
249
+ * @example
250
+ * ```ts
251
+ * massarg(options).option({
252
+ * name: 'number',
253
+ * description: 'A number',
254
+ * defaultValue: 0,
255
+ * aliases: ['n'],
256
+ * type: 'number',
257
+ * })
258
+ * ```
259
+ */
260
+ export declare class MassargNumber extends MassargOption<number> {
261
+ constructor(options: Omit<OptionConfig<number>, 'parse'>);
262
+ parseDetails(argv: string[], options: ArgsObject, prefixes: Prefixes): ArgvValue<number>;
263
+ }
264
+ /**
265
+ * An option that can be passed to a command.
266
+ *
267
+ * A flag is an option that is either present or not. It can be used to toggle
268
+ * a boolean value, or to indicate that a command should be run in a different
269
+ * mode.
270
+ *
271
+ * A flag can be negated by prefixing it with `no-`. For example, `--no-verbose`,
272
+ * or by prefixing the alias with `^` instead of `-`. This is configurable via the command's
273
+ * configuration. To turn this behavior on, set `negatable: true` in the flag's configuration.
274
+ *
275
+ * @example
276
+ * ```ts
277
+ * massarg.flag({
278
+ * name: 'verbose',
279
+ * aliases: ['v'],
280
+ * description: 'Enable verbose logging',
281
+ * defaultValue: false,
282
+ * })
283
+ * ```
284
+ */
285
+ export declare class MassargFlag extends MassargOption<boolean> {
286
+ negatable: boolean;
287
+ constructor(options: FlagConfig);
288
+ parseDetails(argv: string[], _options: ArgsObject, prefixes: Prefixes): ArgvValue<boolean>;
289
+ }
290
+ export declare class MassargHelpFlag extends MassargFlag {
291
+ constructor(config?: Partial<Omit<OptionConfig<boolean>, 'parse'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