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