1 | import { flags as OclifFlags } from '@oclif/command';
|
2 | import * as Parser from '@oclif/parser';
|
3 | import { EnumFlagOptions, IBooleanFlag, IOptionFlag } from '@oclif/parser/lib/flags';
|
4 | import { Duration } from '@salesforce/kit';
|
5 | import { Omit, Optional } from '@salesforce/ts-types';
|
6 | import { URL } from 'url';
|
7 | import { Deprecation } from './ux';
|
8 | export declare namespace flags {
|
9 | type Any<T> = Partial<OclifFlags.IFlag<T>> & SfdxProperties;
|
10 | type Array<T = string> = Option<T[]> & {
|
11 | delimiter?: string;
|
12 | };
|
13 | type BaseBoolean<T> = Partial<IBooleanFlag<T>>;
|
14 | type Boolean<T> = 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> = EnumFlagOptions<T> & SfdxProperties;
|
35 | type Kind = keyof typeof flags;
|
36 | type Input<T extends Parser.flags.Output> = OclifFlags.Input<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> = Partial<IOptionFlag<Optional<T>>> & SfdxProperties & Validatable;
|
46 | type Output = OclifFlags.Output;
|
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 buildInteger(options: flags.Number): flags.Discriminated<flags.Number>;
|
59 | declare function buildOption<T>(options: {
|
60 | parse: (val: string, ctx: unknown) => T;
|
61 | } & flags.Option<T>): flags.Discriminated<flags.Option<T>>;
|
62 | declare function buildString(options: flags.String): flags.Discriminated<flags.String>;
|
63 | declare function buildVersion(options?: flags.BaseBoolean<boolean>): flags.Discriminated<flags.Boolean<void>>;
|
64 | declare function buildArray(options: flags.Array<string>): flags.Discriminated<flags.Array<string>>;
|
65 | declare function buildArray<T>(options: flags.MappedArray<T>): flags.Discriminated<flags.Array<T>>;
|
66 | declare function buildDate(options: flags.DateTime): flags.Discriminated<flags.DateTime>;
|
67 | declare function buildDatetime(options: flags.DateTime): flags.Discriminated<flags.DateTime>;
|
68 | declare function buildDirectory(options: flags.String): flags.Discriminated<flags.String>;
|
69 | declare function buildEmail(options: flags.String): flags.Discriminated<flags.String>;
|
70 | declare function buildFilepath(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 a delimited list of strings with the delimiter defaulting to `,`, e.g., "one,two,three". Accepts
|
111 | * an optional `delimiter` `string` and/or a custom `map` function for converting parsed `string` values into
|
112 | * a type `T`. Produces a parsed (and possibly mapped) array of type `T` where `T` defaults to `string` if no
|
113 | * custom `map` function was provided.
|
114 | */
|
115 | array: typeof buildArray;
|
116 | /**
|
117 | * A flag type for a valid date, e.g., "01-02-2000" or "01/02/2000 01:02:34". Produces a parsed `Date`.
|
118 | */
|
119 | date: typeof buildDate;
|
120 | /**
|
121 | * A flag type for a valid datetime, e.g., "01-02-2000" or "01/02/2000 01:02:34". Produces a parsed `Date`.
|
122 | */
|
123 | datetime: typeof buildDatetime;
|
124 | /**
|
125 | * A flag type for valid directory paths. Produces a validated string.
|
126 | *
|
127 | * **See** [@salesforce/core#sfdc.validatePathDoesNotContainInvalidChars](https:
|
128 | */
|
129 | directory: typeof buildDirectory;
|
130 | |
131 |
|
132 |
|
133 |
|
134 |
|
135 | email: typeof buildEmail;
|
136 | |
137 |
|
138 |
|
139 |
|
140 |
|
141 | filepath: typeof buildFilepath;
|
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 | undefined): flags.Discriminated<flags.Option<string>>;
|
180 | concise(opts?: flags.Builtin | undefined): flags.Discriminated<flags.Boolean<boolean>>;
|
181 | quiet(opts?: flags.Builtin | undefined): flags.Discriminated<flags.Boolean<boolean>>;
|
182 | targetdevhubusername(opts?: flags.Builtin | undefined): flags.Discriminated<flags.Option<string>>;
|
183 | targetusername(opts?: flags.Builtin | undefined): flags.Discriminated<flags.Option<string>>;
|
184 | verbose(opts?: flags.Builtin | undefined): 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 |
|
205 | export declare type FlagsConfig = {
|
206 | [key: string]: Optional<flags.Boolean<unknown> | flags.Option<unknown> | flags.Builtin>;
|
207 | |
208 |
|
209 |
|
210 |
|
211 | apiversion?: flags.Builtin;
|
212 | |
213 |
|
214 |
|
215 |
|
216 |
|
217 | concise?: flags.Builtin;
|
218 | |
219 |
|
220 |
|
221 |
|
222 | quiet?: flags.Builtin;
|
223 | |
224 |
|
225 |
|
226 |
|
227 |
|
228 | verbose?: flags.Builtin;
|
229 | targetdevhubusername?: never;
|
230 | targetusername?: never;
|
231 | };
|
232 |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 |
|
243 | export declare function buildSfdxFlags(flagsConfig: FlagsConfig, options: {
|
244 | targetdevhubusername?: boolean;
|
245 | targetusername?: boolean;
|
246 | }): flags.Output;
|
247 | export {};
|
248 |
|
\ | No newline at end of file |