@optique/run 1.0.0-dev.582 → 1.0.0-dev.586
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/run.d.cts +18 -8
- package/dist/run.d.ts +18 -8
- package/package.json +2 -2
package/dist/run.d.cts
CHANGED
|
@@ -227,9 +227,12 @@ interface RunOptions {
|
|
|
227
227
|
readonly contexts?: readonly SourceContext<unknown>[];
|
|
228
228
|
}
|
|
229
229
|
type RejectEmptyContexts<TContexts extends readonly SourceContext<unknown>[]> = TContexts extends readonly [] ? never : unknown;
|
|
230
|
+
type NonEmptySourceContexts = readonly [SourceContext<unknown>, ...SourceContext<unknown>[]];
|
|
230
231
|
type RejectContextfulOptions<TOptions> = TOptions extends {
|
|
231
|
-
readonly contexts
|
|
232
|
-
} ? TContexts extends readonly [] ? unknown : never : unknown;
|
|
232
|
+
readonly contexts?: infer TContexts extends readonly SourceContext<unknown>[] | undefined;
|
|
233
|
+
} ? [TContexts] extends [undefined | readonly []] ? unknown : never : unknown;
|
|
234
|
+
type RejectUnknownRunOptionKeys<TOptions> = [TOptions] extends [undefined] ? unknown : Exclude<keyof TOptions, keyof RunOptions> extends never ? unknown : never;
|
|
235
|
+
type AcceptExactRunOptions<TOptions> = [TOptions] extends [RunOptions] ? [RunOptions] extends [TOptions] ? unknown : never : never;
|
|
233
236
|
/**
|
|
234
237
|
* Runs a command-line parser with automatic process integration.
|
|
235
238
|
*
|
|
@@ -295,14 +298,19 @@ type RejectContextfulOptions<TOptions> = TOptions extends {
|
|
|
295
298
|
*
|
|
296
299
|
* @since 0.11.0 Added support for {@link Program} objects.
|
|
297
300
|
*/
|
|
301
|
+
declare function run<T extends Parser<Mode, unknown, unknown>, const TContexts extends NonEmptySourceContexts>(parser: T, options: RunOptions & {
|
|
302
|
+
readonly contexts: TContexts;
|
|
303
|
+
} & ExtractRequiredOptions<TContexts, InferValue<T>>): Promise<InferValue<T>>;
|
|
298
304
|
declare function run<T extends Parser<Mode, unknown, unknown>, const TContexts extends readonly SourceContext<unknown>[]>(parser: T, options: RunOptions & {
|
|
299
305
|
readonly contexts: TContexts;
|
|
300
|
-
} & RejectEmptyContexts<TContexts> & ExtractRequiredOptions<TContexts, InferValue<T>>): Promise<InferValue<T>>;
|
|
306
|
+
} & RejectEmptyContexts<TContexts> & ExtractRequiredOptions<TContexts, InferValue<T>>): ModeValue<InferMode<T>, InferValue<T>> | Promise<InferValue<T>>;
|
|
301
307
|
declare function run<M extends Mode, T, const TContexts extends readonly SourceContext<unknown>[]>(program: Program<M, T>, options: RunOptions & {
|
|
302
308
|
readonly contexts: TContexts;
|
|
303
309
|
} & RejectEmptyContexts<TContexts> & ExtractRequiredOptions<TContexts, T>): Promise<T>;
|
|
304
|
-
declare function run<T, const TOptions extends RunOptions | undefined>(program: Program<"sync", T>, options?: TOptions & RejectContextfulOptions<TOptions>): T;
|
|
305
|
-
declare function run<T,
|
|
310
|
+
declare function run<T, const TOptions extends RunOptions | undefined>(program: Program<"sync", T>, options?: TOptions & RejectContextfulOptions<TOptions> & RejectUnknownRunOptionKeys<TOptions>): T;
|
|
311
|
+
declare function run<T, TOptions extends RunOptions>(program: Program<"sync", T>, options: TOptions & AcceptExactRunOptions<TOptions>): T | Promise<T>;
|
|
312
|
+
declare function run<T, const TOptions extends RunOptions | undefined>(program: Program<"async", T>, options?: TOptions & RejectContextfulOptions<TOptions> & RejectUnknownRunOptionKeys<TOptions>): Promise<T>;
|
|
313
|
+
declare function run<T, TOptions extends RunOptions>(program: Program<"async", T>, options: TOptions & AcceptExactRunOptions<TOptions>): Promise<T>;
|
|
306
314
|
declare function run<T extends Parser<"sync", unknown, unknown>>(parser: T, options?: RunOptions): InferValue<T>;
|
|
307
315
|
declare function run<T extends Parser<"async", unknown, unknown>>(parser: T, options?: RunOptions): Promise<InferValue<T>>;
|
|
308
316
|
declare function run<T extends Parser<Mode, unknown, unknown>>(parser: T, options?: RunOptions): ModeValue<InferMode<T>, InferValue<T>>;
|
|
@@ -325,7 +333,8 @@ declare function runSync<T extends Parser<"sync", unknown, unknown>, TContexts e
|
|
|
325
333
|
declare function runSync<T, const TContexts extends readonly SourceContext<unknown>[]>(program: Program<"sync", T>, options: RunOptions & {
|
|
326
334
|
readonly contexts: TContexts;
|
|
327
335
|
} & RejectEmptyContexts<TContexts> & ExtractRequiredOptions<TContexts, T>): T;
|
|
328
|
-
declare function runSync<T, const TOptions extends RunOptions | undefined>(program: Program<"sync", T>, options?: TOptions & RejectContextfulOptions<TOptions>): T;
|
|
336
|
+
declare function runSync<T, const TOptions extends RunOptions | undefined>(program: Program<"sync", T>, options?: TOptions & RejectContextfulOptions<TOptions> & RejectUnknownRunOptionKeys<TOptions>): T;
|
|
337
|
+
declare function runSync<T, TOptions extends RunOptions>(program: Program<"sync", T>, options: TOptions & AcceptExactRunOptions<TOptions>): T;
|
|
329
338
|
declare function runSync<T extends Parser<"sync", unknown, unknown>>(parser: T, options?: RunOptions): InferValue<T>;
|
|
330
339
|
/**
|
|
331
340
|
* Runs an asynchronous command-line parser with automatic process integration.
|
|
@@ -346,8 +355,9 @@ declare function runAsync<T extends Parser<Mode, unknown, unknown>, TContexts ex
|
|
|
346
355
|
declare function runAsync<M extends Mode, T, const TContexts extends readonly SourceContext<unknown>[]>(program: Program<M, T>, options: RunOptions & {
|
|
347
356
|
readonly contexts: TContexts;
|
|
348
357
|
} & RejectEmptyContexts<TContexts> & ExtractRequiredOptions<TContexts, T>): Promise<T>;
|
|
349
|
-
declare function runAsync<T, const TOptions extends RunOptions | undefined>(program: Program<"sync", T>, options?: TOptions & RejectContextfulOptions<TOptions>): Promise<T>;
|
|
350
|
-
declare function runAsync<T, const TOptions extends RunOptions | undefined>(program: Program<"async", T>, options?: TOptions & RejectContextfulOptions<TOptions>): Promise<T>;
|
|
358
|
+
declare function runAsync<T, const TOptions extends RunOptions | undefined>(program: Program<"sync", T>, options?: TOptions & RejectContextfulOptions<TOptions> & RejectUnknownRunOptionKeys<TOptions>): Promise<T>;
|
|
359
|
+
declare function runAsync<T, const TOptions extends RunOptions | undefined>(program: Program<"async", T>, options?: TOptions & RejectContextfulOptions<TOptions> & RejectUnknownRunOptionKeys<TOptions>): Promise<T>;
|
|
360
|
+
declare function runAsync<T, TOptions extends RunOptions>(program: Program<Mode, T>, options: TOptions & AcceptExactRunOptions<TOptions>): Promise<T>;
|
|
351
361
|
declare function runAsync<T extends Parser<Mode, unknown, unknown>>(parser: T, options?: RunOptions): Promise<InferValue<T>>;
|
|
352
362
|
//#endregion
|
|
353
363
|
export { RunOptions, run, runAsync, runSync };
|
package/dist/run.d.ts
CHANGED
|
@@ -227,9 +227,12 @@ interface RunOptions {
|
|
|
227
227
|
readonly contexts?: readonly SourceContext<unknown>[];
|
|
228
228
|
}
|
|
229
229
|
type RejectEmptyContexts<TContexts extends readonly SourceContext<unknown>[]> = TContexts extends readonly [] ? never : unknown;
|
|
230
|
+
type NonEmptySourceContexts = readonly [SourceContext<unknown>, ...SourceContext<unknown>[]];
|
|
230
231
|
type RejectContextfulOptions<TOptions> = TOptions extends {
|
|
231
|
-
readonly contexts
|
|
232
|
-
} ? TContexts extends readonly [] ? unknown : never : unknown;
|
|
232
|
+
readonly contexts?: infer TContexts extends readonly SourceContext<unknown>[] | undefined;
|
|
233
|
+
} ? [TContexts] extends [undefined | readonly []] ? unknown : never : unknown;
|
|
234
|
+
type RejectUnknownRunOptionKeys<TOptions> = [TOptions] extends [undefined] ? unknown : Exclude<keyof TOptions, keyof RunOptions> extends never ? unknown : never;
|
|
235
|
+
type AcceptExactRunOptions<TOptions> = [TOptions] extends [RunOptions] ? [RunOptions] extends [TOptions] ? unknown : never : never;
|
|
233
236
|
/**
|
|
234
237
|
* Runs a command-line parser with automatic process integration.
|
|
235
238
|
*
|
|
@@ -295,14 +298,19 @@ type RejectContextfulOptions<TOptions> = TOptions extends {
|
|
|
295
298
|
*
|
|
296
299
|
* @since 0.11.0 Added support for {@link Program} objects.
|
|
297
300
|
*/
|
|
301
|
+
declare function run<T extends Parser<Mode, unknown, unknown>, const TContexts extends NonEmptySourceContexts>(parser: T, options: RunOptions & {
|
|
302
|
+
readonly contexts: TContexts;
|
|
303
|
+
} & ExtractRequiredOptions<TContexts, InferValue<T>>): Promise<InferValue<T>>;
|
|
298
304
|
declare function run<T extends Parser<Mode, unknown, unknown>, const TContexts extends readonly SourceContext<unknown>[]>(parser: T, options: RunOptions & {
|
|
299
305
|
readonly contexts: TContexts;
|
|
300
|
-
} & RejectEmptyContexts<TContexts> & ExtractRequiredOptions<TContexts, InferValue<T>>): Promise<InferValue<T>>;
|
|
306
|
+
} & RejectEmptyContexts<TContexts> & ExtractRequiredOptions<TContexts, InferValue<T>>): ModeValue<InferMode<T>, InferValue<T>> | Promise<InferValue<T>>;
|
|
301
307
|
declare function run<M extends Mode, T, const TContexts extends readonly SourceContext<unknown>[]>(program: Program<M, T>, options: RunOptions & {
|
|
302
308
|
readonly contexts: TContexts;
|
|
303
309
|
} & RejectEmptyContexts<TContexts> & ExtractRequiredOptions<TContexts, T>): Promise<T>;
|
|
304
|
-
declare function run<T, const TOptions extends RunOptions | undefined>(program: Program<"sync", T>, options?: TOptions & RejectContextfulOptions<TOptions>): T;
|
|
305
|
-
declare function run<T,
|
|
310
|
+
declare function run<T, const TOptions extends RunOptions | undefined>(program: Program<"sync", T>, options?: TOptions & RejectContextfulOptions<TOptions> & RejectUnknownRunOptionKeys<TOptions>): T;
|
|
311
|
+
declare function run<T, TOptions extends RunOptions>(program: Program<"sync", T>, options: TOptions & AcceptExactRunOptions<TOptions>): T | Promise<T>;
|
|
312
|
+
declare function run<T, const TOptions extends RunOptions | undefined>(program: Program<"async", T>, options?: TOptions & RejectContextfulOptions<TOptions> & RejectUnknownRunOptionKeys<TOptions>): Promise<T>;
|
|
313
|
+
declare function run<T, TOptions extends RunOptions>(program: Program<"async", T>, options: TOptions & AcceptExactRunOptions<TOptions>): Promise<T>;
|
|
306
314
|
declare function run<T extends Parser<"sync", unknown, unknown>>(parser: T, options?: RunOptions): InferValue<T>;
|
|
307
315
|
declare function run<T extends Parser<"async", unknown, unknown>>(parser: T, options?: RunOptions): Promise<InferValue<T>>;
|
|
308
316
|
declare function run<T extends Parser<Mode, unknown, unknown>>(parser: T, options?: RunOptions): ModeValue<InferMode<T>, InferValue<T>>;
|
|
@@ -325,7 +333,8 @@ declare function runSync<T extends Parser<"sync", unknown, unknown>, TContexts e
|
|
|
325
333
|
declare function runSync<T, const TContexts extends readonly SourceContext<unknown>[]>(program: Program<"sync", T>, options: RunOptions & {
|
|
326
334
|
readonly contexts: TContexts;
|
|
327
335
|
} & RejectEmptyContexts<TContexts> & ExtractRequiredOptions<TContexts, T>): T;
|
|
328
|
-
declare function runSync<T, const TOptions extends RunOptions | undefined>(program: Program<"sync", T>, options?: TOptions & RejectContextfulOptions<TOptions>): T;
|
|
336
|
+
declare function runSync<T, const TOptions extends RunOptions | undefined>(program: Program<"sync", T>, options?: TOptions & RejectContextfulOptions<TOptions> & RejectUnknownRunOptionKeys<TOptions>): T;
|
|
337
|
+
declare function runSync<T, TOptions extends RunOptions>(program: Program<"sync", T>, options: TOptions & AcceptExactRunOptions<TOptions>): T;
|
|
329
338
|
declare function runSync<T extends Parser<"sync", unknown, unknown>>(parser: T, options?: RunOptions): InferValue<T>;
|
|
330
339
|
/**
|
|
331
340
|
* Runs an asynchronous command-line parser with automatic process integration.
|
|
@@ -346,8 +355,9 @@ declare function runAsync<T extends Parser<Mode, unknown, unknown>, TContexts ex
|
|
|
346
355
|
declare function runAsync<M extends Mode, T, const TContexts extends readonly SourceContext<unknown>[]>(program: Program<M, T>, options: RunOptions & {
|
|
347
356
|
readonly contexts: TContexts;
|
|
348
357
|
} & RejectEmptyContexts<TContexts> & ExtractRequiredOptions<TContexts, T>): Promise<T>;
|
|
349
|
-
declare function runAsync<T, const TOptions extends RunOptions | undefined>(program: Program<"sync", T>, options?: TOptions & RejectContextfulOptions<TOptions>): Promise<T>;
|
|
350
|
-
declare function runAsync<T, const TOptions extends RunOptions | undefined>(program: Program<"async", T>, options?: TOptions & RejectContextfulOptions<TOptions>): Promise<T>;
|
|
358
|
+
declare function runAsync<T, const TOptions extends RunOptions | undefined>(program: Program<"sync", T>, options?: TOptions & RejectContextfulOptions<TOptions> & RejectUnknownRunOptionKeys<TOptions>): Promise<T>;
|
|
359
|
+
declare function runAsync<T, const TOptions extends RunOptions | undefined>(program: Program<"async", T>, options?: TOptions & RejectContextfulOptions<TOptions> & RejectUnknownRunOptionKeys<TOptions>): Promise<T>;
|
|
360
|
+
declare function runAsync<T, TOptions extends RunOptions>(program: Program<Mode, T>, options: TOptions & AcceptExactRunOptions<TOptions>): Promise<T>;
|
|
351
361
|
declare function runAsync<T extends Parser<Mode, unknown, unknown>>(parser: T, options?: RunOptions): Promise<InferValue<T>>;
|
|
352
362
|
//#endregion
|
|
353
363
|
export { RunOptions, run, runAsync, runSync };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/run",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.586+a66615c7",
|
|
4
4
|
"description": "Type-safe combinatorial command-line interface parser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
},
|
|
71
71
|
"sideEffects": false,
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@optique/core": "1.0.0-dev.
|
|
73
|
+
"@optique/core": "1.0.0-dev.586+a66615c7"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@types/node": "^20.19.9",
|