1 | import { StrictValidator } from "typanion";
|
2 | import { CommandOptionReturn, GeneralOptionFlags, WithArity } from "./utils";
|
3 | export type StringOptionNoBoolean<T, Arity extends number = 1> = GeneralOptionFlags & {
|
4 | env?: string;
|
5 | validator?: StrictValidator<unknown, T>;
|
6 | tolerateBoolean?: false;
|
7 | arity?: Arity;
|
8 | };
|
9 | export type StringOptionTolerateBoolean<T> = GeneralOptionFlags & {
|
10 | env?: string;
|
11 | validator?: StrictValidator<unknown, T>;
|
12 | tolerateBoolean: boolean;
|
13 | arity?: 0;
|
14 | };
|
15 | export type StringOption<T> = StringOptionNoBoolean<T> | StringOptionTolerateBoolean<T>;
|
16 | export type StringPositionalFlags<T> = {
|
17 | validator?: StrictValidator<unknown, T>;
|
18 | name?: string;
|
19 | required?: boolean;
|
20 | };
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 | export declare function String(): CommandOptionReturn<string>;
|
30 | export declare function String<T = string>(opts: StringPositionalFlags<T> & {
|
31 | required: false;
|
32 | }): CommandOptionReturn<T | undefined>;
|
33 | export declare function String<T = string>(opts: StringPositionalFlags<T>): CommandOptionReturn<T>;
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 | export declare function String<T extends {} = string, Arity extends number = 1>(descriptor: string, opts: StringOptionNoBoolean<T, Arity> & {
|
43 | required: true;
|
44 | }): CommandOptionReturn<WithArity<T, Arity>>;
|
45 | export declare function String<T extends {} = string, Arity extends number = 1>(descriptor: string, opts?: StringOptionNoBoolean<T, Arity>): CommandOptionReturn<WithArity<T, Arity> | undefined>;
|
46 | export declare function String<T extends {} = string, Arity extends number = 1>(descriptor: string, initialValue: WithArity<string, Arity>, opts?: Omit<StringOptionNoBoolean<T, Arity>, 'required'>): CommandOptionReturn<WithArity<T, Arity>>;
|
47 | export declare function String<T = string>(descriptor: string, opts: StringOptionTolerateBoolean<T> & {
|
48 | required: true;
|
49 | }): CommandOptionReturn<T | boolean>;
|
50 | export declare function String<T = string>(descriptor: string, opts: StringOptionTolerateBoolean<T>): CommandOptionReturn<T | boolean | undefined>;
|
51 | export declare function String<T = string>(descriptor: string, initialValue: string | boolean, opts: Omit<StringOptionTolerateBoolean<T>, 'required'>): CommandOptionReturn<T | boolean>;
|