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