This repository has been archived by the owner on Nov 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
/
IHandlerResponseConsoleApi.ts
53 lines (51 loc) · 2.22 KB
/
IHandlerResponseConsoleApi.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/
import { IPromptOptions } from "./IPromptOptions";
/**
* Handler resposne API for console messages.
* @export
* @interface IHandlerResponseConsoleApi
*/
export interface IHandlerResponseConsoleApi {
/**
* Write a message to stdout (or buffers in silent/JSON mode). Automatically appends a newline to the message.
* @param {string} message - The message (or format string) to write to stdout.
* @param {...any[]} values - The format string values for substitution/formatting.
* @returns {string} - The verbatim message written.
* @memberof IHandlerResponseConsoleApi
*/
log(message: string | Buffer, ...values: any[]): string;
/**
* Write a message to stderr (or buffers in silent/JSON mode). Automatically appends a newline to the message.
* @param {string} message - The message (or format string) to write to stderr
* @param {...any[]} values - The format string values for substitution/formatting.
* @returns {string} - The verbatim message written.
* @memberof IHandlerResponseConsoleApi
*/
error(message: string | Buffer, ...values: any[]): string;
/**
* Writes an error header to stderr. The header is colorized (to red), appends a colon (e.g. "Syntax Error:"),
* and a new line. The intention of the error header is to begin an error block of text with a "tag" (the header).
* @param {string} message - The message as the header.
* @param {string} [delimeter] - The a delimeter to print after the message (defaults to ":").
* @returns {string}
* @memberof IHandlerResponseConsoleApi
*/
errorHeader(message: string, delimeter?: string): string;
/**
* Handles prompting for CLI handlers
* @param {string} questionText
* @param {IPromptOptions} [opts]
* @returns {Promise<String>}
* @memberof IHandlerResponseConsoleApi
*/
prompt(questionText: string, opts?: IPromptOptions): Promise<string>;
}