/** 显示命令行的光标 */ export declare function showCursor(): void; /** 隐藏命令行的光标 */ export declare function hideCursor(): void; /** 清空命令行(含缓冲区)*/ export declare function clear(): void; /** * 解析命令行参数 * @param commandLineOptions 所有内置的命令行选项 * @param onError 解析出错后的回调函数 * @param argv 要解析的命令行参数列表 * @param startIndex 开始解析的索引 * @returns 返回一个对象,对象的键是参数名或索引,对象的值是对应的参数值(如果没有参数值则为 `true`) * @example * ``` * // 假设启动程序的命令行是:`node a --x b --y c` * parseCommandLineArguments({ * "--x": { * argument: "argument" * } * }) * // {"0": "a", "1": "c", "x": "b", "y": true} * ``` */ export declare function parseCommandLineArguments(commandLineOptions?: { [option: string]: CommandLineOption; }, onError?: (message: string) => void, argv?: string[], startIndex?: number): { [option: string]: string | true | string[] | any; }; /** * 格式化所有选项 * @param commandLineOptions 所有内置的命令行选项 * @param maxWidth 允许布局的最大宽度(一般地,西文字母宽度为 1,中文文字宽度为 2) */ export declare function formatCommandLineOptions(commandLineOptions: { [option: string]: CommandLineOption; }, maxWidth?: number): string; /** 表示一个命令行选项 */ export interface CommandLineOption { /** 当前选项所属的分组,主要用于格式化时显示 */ group?: string; /** 当前选项的别名 */ alias?: string | string[]; /** 当前选项的描述,主要用于格式化时显示 */ description?: string; /** 当前选项的参数名,如果未设置说明没有参数 */ argument?: string; /** 当前选项的默认值,如果未设置则表示当前选项是必填的 */ default?: any; /** 是否允许重复使用当前选项 */ multiple?: boolean; } /** * 读取命令行的输入 * @param message 提示的信息 * @example await commandLine.input("请输入名字:") */ export declare function input(message?: string): Promise; /** * 让用户选择一项 * @param choices 要展示的选择项 * @param message 提示的信息 * @param defaultValue 默认值 * @example await commandLine.select(["打开", "关闭"], "请选择一个:") */ export declare function select(choices: string[], message?: string, defaultValue?: string): Promise;