1 | import { Change } from "diff";
|
2 | import { Answers, PromptModule, QuestionCollection } from "inquirer";
|
3 | import { Logger } from "./util/log";
|
4 |
|
5 | declare namespace TerminalAdapter {
|
6 | |
7 |
|
8 |
|
9 | interface AdapterOptions {
|
10 | |
11 |
|
12 |
|
13 | console?: Console | undefined;
|
14 | }
|
15 |
|
16 | |
17 |
|
18 |
|
19 | type Questions<T extends Answers> = QuestionCollection<T>;
|
20 | }
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | declare class TerminalAdapter {
|
29 | |
30 |
|
31 |
|
32 | promptModule: PromptModule;
|
33 |
|
34 | |
35 |
|
36 |
|
37 | console: Console;
|
38 |
|
39 | |
40 |
|
41 |
|
42 | log: Logger;
|
43 |
|
44 | |
45 |
|
46 |
|
47 |
|
48 |
|
49 | constructor(options: TerminalAdapter.AdapterOptions);
|
50 |
|
51 | /**
|
52 | * Prompts the user for one or more questions.
|
53 | *
|
54 | * @param questions The questions to prompt.
|
55 | */
|
56 | prompt<T extends Answers>(questions: TerminalAdapter.Questions<T>): Promise<T>;
|
57 |
|
58 | /**
|
59 | * Prompts the user for one or more questions.
|
60 | *
|
61 | * @param questions The questions to prompt.
|
62 | * @param cb Deprecated: The callback for handling the result.
|
63 | */
|
64 | prompt<TAnswers extends Answers, TResult>(
|
65 | questions: TerminalAdapter.Questions<TAnswers>,
|
66 | answers?: TAnswers,
|
67 | cb?: (res: TAnswers) => TResult,
|
68 | ): Promise<TResult>;
|
69 |
|
70 | /**
|
71 | * Shows a color-based diff of two strings.
|
72 | *
|
73 | * @param actual The actual text.
|
74 | * @param expected The expected text.
|
75 | * @param changes The changes returned by `diff`.
|
76 | * @returns The formatted message.
|
77 | */
|
78 | diff(actual: string, expected: string, changes: Change[]): string;
|
79 | }
|
80 |
|
81 | export = TerminalAdapter;
|