xonecas.io
6615
Yc

yoctoselect / files

yoctoselect / src / ansi.ts

369 bytes
1const ESC = "\x1b[";
2
3export function cursorUp(n: number): string {
4  return n > 0 ? `${ESC}${n}A` : "";
5}
6
7export function clearDown(): string {
8  return `${ESC}J`;
9}
10
11export function hideCursor(): string {
12  return `${ESC}?25l`;
13}
14
15export function showCursor(): string {
16  return `${ESC}?25h`;
17}
18
19export function write(s: string): void {
20  process.stdout.write(s);
21}