1 | declare module 'tty' {
|
---|
2 | import * as net from 'net';
|
---|
3 |
|
---|
4 | function isatty(fd: number): boolean;
|
---|
5 | class ReadStream extends net.Socket {
|
---|
6 | constructor(fd: number, options?: net.SocketConstructorOpts);
|
---|
7 | isRaw: boolean;
|
---|
8 | setRawMode(mode: boolean): this;
|
---|
9 | isTTY: boolean;
|
---|
10 | }
|
---|
11 | /**
|
---|
12 | * -1 - to the left from cursor
|
---|
13 | * 0 - the entire line
|
---|
14 | * 1 - to the right from cursor
|
---|
15 | */
|
---|
16 | type Direction = -1 | 0 | 1;
|
---|
17 | class WriteStream extends net.Socket {
|
---|
18 | constructor(fd: number);
|
---|
19 | addListener(event: string, listener: (...args: any[]) => void): this;
|
---|
20 | addListener(event: "resize", listener: () => void): this;
|
---|
21 |
|
---|
22 | emit(event: string | symbol, ...args: any[]): boolean;
|
---|
23 | emit(event: "resize"): boolean;
|
---|
24 |
|
---|
25 | on(event: string, listener: (...args: any[]) => void): this;
|
---|
26 | on(event: "resize", listener: () => void): this;
|
---|
27 |
|
---|
28 | once(event: string, listener: (...args: any[]) => void): this;
|
---|
29 | once(event: "resize", listener: () => void): this;
|
---|
30 |
|
---|
31 | prependListener(event: string, listener: (...args: any[]) => void): this;
|
---|
32 | prependListener(event: "resize", listener: () => void): this;
|
---|
33 |
|
---|
34 | prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
---|
35 | prependOnceListener(event: "resize", listener: () => void): this;
|
---|
36 |
|
---|
37 | /**
|
---|
38 | * Clears the current line of this WriteStream in a direction identified by `dir`.
|
---|
39 | */
|
---|
40 | clearLine(dir: Direction, callback?: () => void): boolean;
|
---|
41 | /**
|
---|
42 | * Clears this `WriteStream` from the current cursor down.
|
---|
43 | */
|
---|
44 | clearScreenDown(callback?: () => void): boolean;
|
---|
45 | /**
|
---|
46 | * Moves this WriteStream's cursor to the specified position.
|
---|
47 | */
|
---|
48 | cursorTo(x: number, y?: number, callback?: () => void): boolean;
|
---|
49 | cursorTo(x: number, callback: () => void): boolean;
|
---|
50 | /**
|
---|
51 | * Moves this WriteStream's cursor relative to its current position.
|
---|
52 | */
|
---|
53 | moveCursor(dx: number, dy: number, callback?: () => void): boolean;
|
---|
54 | /**
|
---|
55 | * @default `process.env`
|
---|
56 | */
|
---|
57 | getColorDepth(env?: {}): number;
|
---|
58 | hasColors(depth?: number): boolean;
|
---|
59 | hasColors(env?: {}): boolean;
|
---|
60 | hasColors(depth: number, env?: {}): boolean;
|
---|
61 | getWindowSize(): [number, number];
|
---|
62 | columns: number;
|
---|
63 | rows: number;
|
---|
64 | isTTY: boolean;
|
---|
65 | }
|
---|
66 | }
|
---|