1 | import { Optional } from '@salesforce/ts-types';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | import { Logger } from '@salesforce/core';
|
26 | import { CliUx } from '@oclif/core';
|
27 | import { Options as OclifActionOptions } from '@oclif/core/lib/cli-ux/action/base';
|
28 | import { IPromptOptions } from '@oclif/core/lib/cli-ux';
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | export declare class UX {
|
34 | private logger;
|
35 | |
36 |
|
37 |
|
38 |
|
39 |
|
40 | static warnings: Set<string>;
|
41 | cli: typeof CliUx;
|
42 | private isOutputEnabled;
|
43 | |
44 |
|
45 |
|
46 | constructor(logger: Logger, isOutputEnabled?: boolean, ux?: typeof CliUx);
|
47 | /**
|
48 | * Formats a deprecation warning for display to `stderr`, `stdout`, and/or logs.
|
49 | *
|
50 | * @param {DeprecationDefinition} def The definition for the deprecated object.
|
51 | * @returns {string} The formatted deprecation message.
|
52 | */
|
53 | static formatDeprecationWarning(def: DeprecationDefinition): string;
|
54 | |
55 |
|
56 |
|
57 |
|
58 |
|
59 | static create(): Promise<UX>;
|
60 | |
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 | log(...args: string[]): UX;
|
67 | |
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 | logJson(obj: Record<string, unknown>): UX;
|
75 | |
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 | prompt(name: string, options?: IPromptOptions): Promise<string>;
|
83 | |
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 | confirm(message: string): Promise<boolean>;
|
90 | |
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 | startSpinner(message: string, status?: string, opts?: OclifActionOptions): void;
|
98 | |
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 | pauseSpinner<T>(fn: () => T, icon?: string): Optional<T>;
|
106 | /**
|
107 | * Update the spinner status.
|
108 | *
|
109 | * @param {string} status The message displayed to the user.
|
110 | */
|
111 | setSpinnerStatus(status?: string): void;
|
112 | /**
|
113 | * Get the spinner status.
|
114 | *
|
115 | * @returns {Optional<string>}
|
116 | */
|
117 | getSpinnerStatus(): Optional<string>;
|
118 | /**
|
119 | * Stop the spinner action.
|
120 | *
|
121 | * @param {string} message The message displayed to the user.
|
122 | */
|
123 | stopSpinner(message?: string): void;
|
124 | /**
|
125 | * Logs a warning as `WARN` level and conditionally writes to `stderr` if the log
|
126 | * level is `WARN` or above and stream output is enabled. The message is added
|
127 | * to the static {@link UX.warnings} set if stream output is _not_ enabled, for later
|
128 | * consumption and manipulation.
|
129 | *
|
130 | * @param {string} message The warning message to output.
|
131 | * @returns {UX}
|
132 | * @see UX.warnings
|
133 | */
|
134 | warn(message: string): UX;
|
135 | /**
|
136 | * Logs an error at `ERROR` level and conditionally writes to `stderr` if stream
|
137 | * output is enabled.
|
138 | *
|
139 | * @param {...any[]} args The errors to log.
|
140 | * @returns {UX}
|
141 | */
|
142 | error(...args: unknown[]): UX;
|
143 | /**
|
144 | * Logs an object as JSON at `ERROR` level and to `stderr`.
|
145 | *
|
146 | * @param {object} obj The error object to log -- must be serializable as JSON.
|
147 | * @returns {UX}
|
148 | * @throws {TypeError} If the object is not JSON-serializable.
|
149 | */
|
150 | errorJson(obj: object): UX;
|
151 | /**
|
152 | * Logs at `INFO` level and conditionally writes to `stdout` in a table format if
|
153 | * stream output is enabled.
|
154 | *
|
155 | * @param {object[]} rows The rows of data to be output in table format.
|
156 | * @param columns Table column options
|
157 | * @param {SfdxTableOptions} options The {@link SfdxTableOptions} to use for formatting.
|
158 | * @returns {UX}
|
159 | */
|
160 | table(rows: any[], columns?: TableColumns, options?: CliUx.Table.table.Options): UX;
|
161 | /**
|
162 | * Logs at `INFO` level and conditionally writes to `stdout` in a styled object format if
|
163 | * stream output is enabled.
|
164 | *
|
165 | * @param {object} obj The object to be styled for stdout.
|
166 | * @param {string[]} [keys] The object keys to be written to stdout.
|
167 | * @returns {UX}
|
168 | */
|
169 | styledObject(obj: object, keys?: string[]): UX;
|
170 | /**
|
171 | * Log at `INFO` level and conditionally write to `stdout` in styled JSON format if
|
172 | * stream output is enabled.
|
173 | *
|
174 | * @param {object} obj The object to be styled for stdout.
|
175 | * @returns {UX}
|
176 | */
|
177 | styledJSON(obj: object): UX;
|
178 | /**
|
179 | * Logs at `INFO` level and conditionally writes to `stdout` in a styled header format if
|
180 | * stream output is enabled.
|
181 | *
|
182 | * @param {string} header The header to be styled.
|
183 | * @returns {UX}
|
184 | */
|
185 | styledHeader(header: string): UX;
|
186 | }
|
187 | /**
|
188 | * A table option configuration type. May be a detailed configuration, or
|
189 | * more simply just a string array in the simple cases where table header values
|
190 | * are the only desired config option.
|
191 | */
|
192 | export type TableColumns = CliUx.Table.table.Columns<any> | string[];
|
193 | /**
|
194 | * A deprecation configuration type. A typical instance can pass `name`,
|
195 | * `type`, and `version` for a standard message. Alternatively, the `messageOverride` can
|
196 | * be used as a special case deprecated message. Used when defining a deprecation on a
|
197 | * command or flag.
|
198 | */
|
199 | export type Deprecation = {
|
200 | to?: string;
|
201 | message?: string;
|
202 | } & ({
|
203 | version: number | string;
|
204 | } | {
|
205 | messageOverride: string;
|
206 | });
|
207 | /**
|
208 | *
|
209 | * @deprecated use deprecation from oclif/core
|
210 | *
|
211 | * A deprecation warning message configuration type. A typical instance can pass `name`,
|
212 | * `type`, and `version` for a standard message. Alternatively, the `messageOverride` can
|
213 | * be used as a special case deprecated message. Used when formatting a deprecation message.
|
214 | */
|
215 | export type DeprecationDefinition = {
|
216 | to?: string;
|
217 | message?: string;
|
218 | } & ({
|
219 | version: number | string;
|
220 | name: string;
|
221 | type: string;
|
222 | } | {
|
223 | messageOverride: string;
|
224 | });
|
225 |
|
\ | No newline at end of file |