1 |
|
2 | import { URL } from 'url';
|
3 | import { Duration } from '@salesforce/kit';
|
4 | import { Omit, Optional } from '@salesforce/ts-types';
|
5 | import { BooleanFlag, EnumFlagOptions, Flag as OclifFlag, FlagInput, FlagOutput, OptionFlag } from '@oclif/core/lib/interfaces';
|
6 | import { Deprecation } from './ux';
|
7 | export declare namespace flags {
|
8 | type Any<T> = Partial<OclifFlag<T>> & SfdxProperties;
|
9 | type Array<T = string> = Option<T[]> & {
|
10 | delimiter?: string;
|
11 | };
|
12 | type BaseBoolean<T> = Partial<BooleanFlag<T>>;
|
13 | type Boolean<T> = BaseBoolean<T> & SfdxProperties;
|
14 | type Bounds<T> = {
|
15 | min?: T;
|
16 | max?: T;
|
17 | };
|
18 | type Builtin = {
|
19 | type: 'builtin';
|
20 | } & Partial<SfdxProperties>;
|
21 | type DateTime = Option<Date>;
|
22 | type Deprecatable = {
|
23 | deprecated?: Deprecation;
|
24 | };
|
25 | type Describable = {
|
26 | description: string;
|
27 | longDescription?: string;
|
28 | };
|
29 | type Discriminant = {
|
30 | kind: Kind;
|
31 | };
|
32 | type Discriminated<T> = T & Discriminant;
|
33 | type Enum<T> = EnumFlagOptions<T> & SfdxProperties;
|
34 | type Kind = keyof typeof flags;
|
35 | type Input<T extends FlagOutput> = FlagInput<T>;
|
36 | type MappedArray<T> = Omit<flags.Array<T>, 'options'> & {
|
37 | map: (val: string) => T;
|
38 | options?: T[];
|
39 | };
|
40 | type Milliseconds = Option<Duration> & Bounds<Duration | number>;
|
41 | type Minutes = Option<Duration> & Bounds<Duration | number>;
|
42 | type Number = Option<number> & NumericBounds;
|
43 | type NumericBounds = Bounds<number>;
|
44 | type Option<T> = Partial<OptionFlag<T>> & SfdxProperties & Validatable;
|
45 | type Output = FlagOutput;
|
46 | type Seconds = Option<Duration> & Bounds<Duration | number>;
|
47 | type SfdxProperties = Describable & Deprecatable;
|
48 | type String = Option<string>;
|
49 | type Url = Option<URL>;
|
50 | type Validatable = {
|
51 | validate?: string | RegExp | ((val: string) => boolean);
|
52 | };
|
53 | }
|
54 | declare function buildBoolean<T = boolean>(options: flags.Boolean<T>): flags.Discriminated<flags.Boolean<T>>;
|
55 | declare function buildEnum<T>(options: flags.Enum<T>): flags.Discriminated<flags.Enum<T>>;
|
56 | declare function buildHelp(options: flags.BaseBoolean<boolean>): flags.Discriminated<flags.Boolean<void>>;
|
57 | declare function buildFilepath(options: flags.String): flags.Discriminated<flags.String>;
|
58 | declare function buildDirectory(options: flags.String): flags.Discriminated<flags.String>;
|
59 | declare function buildInteger(options: flags.Number): flags.Discriminated<flags.Number>;
|
60 | declare function buildOption<T>(options: {
|
61 | parse: (val: string, ctx: unknown) => T;
|
62 | } & flags.Option<T>): flags.Discriminated<flags.Option<T>>;
|
63 | declare function buildString(options: flags.String): flags.Discriminated<flags.String>;
|
64 | declare function buildVersion(options?: flags.BaseBoolean<boolean>): flags.Discriminated<flags.Boolean<void>>;
|
65 | declare function buildArray(options: flags.Array<string>): flags.Discriminated<flags.Array<string>>;
|
66 | declare function buildArray<T>(options: flags.MappedArray<T>): flags.Discriminated<flags.Array<T>>;
|
67 | declare function buildDate(options: flags.DateTime): flags.Discriminated<flags.DateTime>;
|
68 | declare function buildDatetime(options: flags.DateTime): flags.Discriminated<flags.DateTime>;
|
69 | declare function buildEmail(options: flags.String): flags.Discriminated<flags.String>;
|
70 | declare function buildId(options: flags.String): flags.Discriminated<flags.String>;
|
71 | declare function buildMilliseconds(options: flags.Milliseconds): flags.Discriminated<flags.Milliseconds>;
|
72 | declare function buildMinutes(options: flags.Minutes): flags.Discriminated<flags.Minutes>;
|
73 | declare function buildNumber(options: flags.Number): flags.Discriminated<flags.Number>;
|
74 | declare function buildSeconds(options: flags.Seconds): flags.Discriminated<flags.Seconds>;
|
75 | declare function buildUrl(options: flags.Url): flags.Discriminated<flags.Url>;
|
76 | declare function buildBuiltin(options?: Partial<flags.Builtin>): flags.Builtin;
|
77 | export declare const flags: {
|
78 | /**
|
79 | * A flag type whose presence indicates a `true` boolean value. Produces false when not present.
|
80 | */
|
81 | boolean: typeof buildBoolean;
|
82 | /**
|
83 | * A flag type with a fixed enumeration of possible option values. Produces a validated string from the `options` list.
|
84 | */
|
85 | enum: typeof buildEnum;
|
86 | /**
|
87 | * A flag type useful for overriding the short `char` trigger for emitting CLI help. Emits help and exits the CLI.
|
88 | */
|
89 | help: typeof buildHelp;
|
90 | /**
|
91 | * A flag type that accepts basic integer values. For floats, binary, octal, and hex, see {@link flags.number}.
|
92 | * Produces an integer `number`.
|
93 | */
|
94 | integer: typeof buildInteger;
|
95 | /**
|
96 | * A flag type for custom string processing. Accepts a `parse` function that converts a `string` value to a type `T`.
|
97 | * Produces a type `T`.
|
98 | */
|
99 | option: typeof buildOption;
|
100 | /**
|
101 | * A flag type for returning a raw `string` value without further preprocessing. Produces a string.
|
102 | */
|
103 | string: typeof buildString;
|
104 | /**
|
105 | * A flag type for emitting CLI version information. Emits the CLI version and exits the CLI.
|
106 | */
|
107 | version: typeof buildVersion;
|
108 | /**
|
109 | * A flag type for valid file paths. Produces a validated string.
|
110 | *
|
111 | * **See** [@salesforce/core#sfdc.validatePathDoesNotContainInvalidChars](https:
|
112 | */
|
113 | filepath: typeof buildFilepath;
|
114 | |
115 |
|
116 |
|
117 |
|
118 |
|
119 | directory: typeof buildDirectory;
|
120 | |
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 | array: typeof buildArray;
|
127 | |
128 |
|
129 |
|
130 | date: typeof buildDate;
|
131 | |
132 |
|
133 |
|
134 | datetime: typeof buildDatetime;
|
135 | |
136 |
|
137 |
|
138 |
|
139 |
|
140 | email: typeof buildEmail;
|
141 | |
142 |
|
143 |
|
144 |
|
145 |
|
146 | id: typeof buildId;
|
147 | |
148 |
|
149 |
|
150 | milliseconds: typeof buildMilliseconds;
|
151 | |
152 |
|
153 |
|
154 | minutes: typeof buildMinutes;
|
155 | |
156 |
|
157 |
|
158 |
|
159 | number: typeof buildNumber;
|
160 | |
161 |
|
162 |
|
163 | seconds: typeof buildSeconds;
|
164 | |
165 |
|
166 |
|
167 | url: typeof buildUrl;
|
168 | |
169 |
|
170 |
|
171 | builtin: typeof buildBuiltin;
|
172 | };
|
173 | export declare const requiredBuiltinFlags: {
|
174 | json(): flags.Discriminated<flags.Boolean<boolean>>;
|
175 | loglevel(): flags.Discriminated<flags.Enum<string>>;
|
176 | };
|
177 | export declare const optionalBuiltinFlags: {
|
178 | apiversion(opts?: flags.Builtin | undefined): flags.Discriminated<flags.String>;
|
179 | concise(opts?: flags.Builtin | undefined): flags.Discriminated<flags.Boolean<boolean>>;
|
180 | quiet(opts?: flags.Builtin | undefined): flags.Discriminated<flags.Boolean<boolean>>;
|
181 | targetdevhubusername(opts?: flags.Builtin | undefined): flags.Discriminated<flags.String>;
|
182 | targetusername(opts?: flags.Builtin | undefined): flags.Discriminated<flags.String>;
|
183 | verbose(opts?: flags.Builtin | undefined): flags.Discriminated<flags.Boolean<boolean>>;
|
184 | };
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 | export declare type FlagsConfig = {
|
204 | [key: string]: Optional<flags.Boolean<unknown> | flags.Option<unknown> | flags.Builtin>;
|
205 | |
206 |
|
207 |
|
208 |
|
209 | apiversion?: flags.Builtin;
|
210 | |
211 |
|
212 |
|
213 |
|
214 |
|
215 | concise?: flags.Builtin;
|
216 | |
217 |
|
218 |
|
219 |
|
220 | quiet?: flags.Builtin;
|
221 | |
222 |
|
223 |
|
224 |
|
225 |
|
226 | verbose?: flags.Builtin;
|
227 | targetdevhubusername?: never;
|
228 | targetusername?: never;
|
229 | };
|
230 |
|
231 |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 |
|
239 |
|
240 |
|
241 | export declare function buildSfdxFlags(flagsConfig: FlagsConfig, options: {
|
242 | targetdevhubusername?: boolean;
|
243 | targetusername?: boolean;
|
244 | }): flags.Output;
|
245 | export {};
|
246 |
|
\ | No newline at end of file |