1
1
import { AnsiEscape } from '../ansi-escape/ansi-escape.ts' ;
2
2
import { KeyCode } from '../keycode/key-code.ts' ;
3
3
import { KeyEvent } from '../keycode/key-event.ts' ;
4
- import format from '../x/format.ts' ;
5
4
import { blue , bold , dim , green , red , yellow } from './deps.ts' ;
6
5
import { Figures } from './figures.ts' ;
7
6
@@ -206,12 +205,12 @@ export abstract class GenericPrompt<T, V, S extends GenericPromptSettings<T, V>,
206
205
) ;
207
206
}
208
207
209
- protected write ( ... args : any [ ] ) {
210
- Deno . stdout . writeSync ( new TextEncoder ( ) . encode ( format ( ... args ) ) ) ;
208
+ protected write ( value : string ) {
209
+ Deno . stdout . writeSync ( new TextEncoder ( ) . encode ( value ) ) ;
211
210
}
212
211
213
- protected writeLine ( ... args : any [ ] ) {
214
- Deno . stdout . writeSync ( new TextEncoder ( ) . encode ( format ( ... args ) + '\n' ) ) ;
212
+ protected writeLine ( value ?: string ) {
213
+ Deno . stdout . writeSync ( new TextEncoder ( ) . encode ( ( value ?? '' ) + '\n' ) ) ;
215
214
}
216
215
217
216
protected preBufferEmptyLines ( message : string ) {
@@ -220,18 +219,18 @@ export abstract class GenericPrompt<T, V, S extends GenericPromptSettings<T, V>,
220
219
this . screen . cursorUp ( linesCount ) ;
221
220
}
222
221
223
- protected error ( ... args : any [ ] ) {
222
+ protected error ( message : string ) {
224
223
if ( typeof GenericPrompt . injectedValue !== 'undefined' ) {
225
- throw new Error ( red ( bold ( ` ${ Figures . CROSS } ` ) + format ( ... args ) ) ) ;
224
+ throw new Error ( red ( bold ( ` ${ Figures . CROSS } ` ) + message ) ) ;
226
225
}
227
- this . write ( red ( bold ( ` ${ Figures . CROSS } ` ) + format ( ... args ) ) ) ;
226
+ this . write ( red ( bold ( ` ${ Figures . CROSS } ` ) + message ) ) ;
228
227
}
229
228
230
- protected message ( ... args : any [ ] ) {
231
- this . write ( blue ( ` ${ Figures . POINTER } ` ) + format ( ... args ) ) ;
229
+ protected message ( message : string ) {
230
+ this . write ( blue ( ` ${ Figures . POINTER } ` ) + message ) ;
232
231
}
233
232
234
- protected hint ( ... args : any [ ] ) {
235
- this . write ( dim ( blue ( ` ${ Figures . POINTER } ` ) + format ( ... args ) ) ) ;
233
+ protected hint ( hint : string ) {
234
+ this . write ( dim ( blue ( ` ${ Figures . POINTER } ` ) + hint ) ) ;
236
235
}
237
236
}
0 commit comments