1+ import { Console } from 'node:console' ;
2+ import process from 'node:process' ;
13import prompts , { type PromptObject , type PromptType } from 'prompts' ;
24import { ClideError , type ClideErrorOptions } from 'src/core/errors' ;
35import type { KeyMap , Replace } from 'src/utils/types' ;
@@ -75,21 +77,17 @@ export type PromptParams<T extends PromptType = PromptType> = Replace<
7577 * [prompts](https://github.com/terkelg/prompts).
7678 * @group Client
7779 */
78- export class Client {
79- /**
80- * Log a message to stdout.
81- * @param message - Any number of arguments to log.
82- */
83- log ( ...message : unknown [ ] ) {
84- console . log ( ...message ) ;
80+ export class Client extends Console {
81+ constructor ( { stdout = process . stdout , stderr = process . stderr } = { } ) {
82+ super ( { stdout, stderr } ) ;
8583 }
8684
8785 /**
8886 * Log an error message to stderr.
8987 * @param error - The error to log.
9088 * @returns The error wrapped in a {@linkcode ClientError}.
9189 */
92- error ( error : unknown ) {
90+ override error ( error : unknown ) {
9391 const clientError = new ClientError ( error ) ;
9492 console . error (
9593 `\n${
@@ -101,14 +99,6 @@ export class Client {
10199 return clientError ;
102100 }
103101
104- /**
105- * Log a warning message to stdout.
106- * @param warning - Any number of arguments to log.
107- */
108- warn ( ...warning : any ) {
109- console . warn ( ...warning ) ;
110- }
111-
112102 /**
113103 * Prompt the user for input.
114104 * @param prompt - The prompt options.
0 commit comments