UNPKG

@sprucelabs/spruce-cli

Version:

Command line interface for building Spruce skills.

70 lines (69 loc) 2.99 kB
import { FieldDefinitionValueType } from '@sprucelabs/schema'; import ora from 'ora'; import { FieldDefinitions } from './../.spruce/schemas/fields/fields.types'; import { ExecutionResults, GraphicsInterface } from '../types/cli.types'; import { GraphicsTextEffect, ImageDimensions, ProgressBarOptions, ProgressBarUpdateOptions } from '../types/graphicsInterface.types'; interface TerminalSpecificOptions { eraseBeforeRender?: boolean; } export default class TerminalInterface implements GraphicsInterface { private static loader?; private static _doesSupportColor; static ora: { (options?: ora.Options | string): ora.Ora; promise(action: PromiseLike<unknown>, options?: ora.Options | string): ora.Ora; }; isPromptActive: boolean; cwd: string; private renderStackTraces; private progressBar; private log; constructor(cwd: string, renderStackTraces?: boolean, log?: (message?: any, ...optionalParams: any[]) => void); static doesSupportColor(): boolean; static setDoesSupportColor(isTTy: boolean): void; sendInput(): Promise<void>; renderLines(lines: any[], effects?: GraphicsTextEffect[]): void; renderObject(object: Record<string, any>, effects?: GraphicsTextEffect[]): void; renderSection(options: { headline?: string; lines?: string[]; object?: Record<string, any>; headlineEffects?: GraphicsTextEffect[]; bodyEffects?: GraphicsTextEffect[]; dividerEffects?: GraphicsTextEffect[]; }): void; renderDivider(effects?: GraphicsTextEffect[]): void; renderActionSummary(results: ExecutionResults & { totalTime?: number; }): void; renderHeadline(message: string, effects?: GraphicsTextEffect[], dividerEffects?: GraphicsTextEffect[]): void; setTitle(title: string): void; renderHero(message: string, effects?: GraphicsTextEffect[]): void; renderHint(message: string): void; renderLine(message: any, effects?: GraphicsTextEffect[], options?: TerminalSpecificOptions): void; renderWarning(message: string): void; startLoading(message?: string): Promise<void>; stopLoading(): void; confirm(question: string): Promise<boolean>; waitForEnter(message?: string): Promise<void>; clear(): void; renderCodeSample(code: string): void; prompt<T extends FieldDefinitions>(definition: T): Promise<FieldDefinitionValueType<T>>; private generatePromptLabel; renderError(err: Error): void; private cleanStack; renderProgressBar(options: ProgressBarOptions): void; removeProgressBar(): void; updateProgressBar(options: ProgressBarUpdateOptions): void; renderImage(_path: string, _options?: ImageDimensions): Promise<void>; getCursorPosition(): Promise<{ x: number; y: number; } | null>; saveCursor(): void; restoreCursor(): void; moveCursorTo(x: number, y: number): void; clearBelowCursor(): void; eraseLine(): void; } export {};