Spaces:
Paused
Paused
|
Download node_modules/@inquirer/ansi/README.md from Leon4gr45/augmenttoolkit: direct link, hf CLI and curl.
- Browser
- Download file 1.76 kB
-
https://huggingface.co/spaces/Leon4gr45/augmenttoolkit/resolve/main/node_modules/%40inquirer/ansi/README.md
- Command line
-
hf download hf://spaces/Leon4gr45/augmenttoolkit/node_modules/@inquirer/ansi/README.md
-
curl -L -o README.md https://huggingface.co/spaces/Leon4gr45/augmenttoolkit/resolve/main/node_modules/%40inquirer/ansi/README.md
1.76 kB
@inquirer/ansi
A lightweight package providing ANSI escape sequences for terminal cursor manipulation and screen clearing.
Installation
| npm | yarn |
|---|---|
|
|
Usage
import {
cursorUp,
cursorDown,
cursorTo,
cursorLeft,
cursorHide,
cursorShow,
eraseLines,
} from '@inquirer/ansi';
// Move cursor up 3 lines
process.stdout.write(cursorUp(3));
// Move cursor to specific position (x: 10, y: 5)
process.stdout.write(cursorTo(10, 5));
// Hide/show cursor
process.stdout.write(cursorHide);
process.stdout.write(cursorShow);
// Clear 5 lines
process.stdout.write(eraseLines(5));
Or when used inside an inquirer prompt:
import { cursorHide } from '@inquirer/ansi';
import { createPrompt } from '@inquirer/core';
export default createPrompt((config, done: (value: void) => void) => {
return `Choose an option${cursorHide}`;
});
API
Cursor Movement
cursorUp(count?: number)- Move cursor up bycountlines (default: 1)cursorDown(count?: number)- Move cursor down bycountlines (default: 1)cursorTo(x: number, y?: number)- Move cursor to position (x, y). If y is omitted, only moves horizontallycursorLeft- Move cursor to beginning of line
Cursor Visibility
cursorHide- Hide the cursorcursorShow- Show the cursor
Screen Manipulation
eraseLines(count: number)- Clearcountlines and position cursor at the beginning of the first cleared line
License
Copyright (c) 2025 Simon Boudrias (twitter: @vaxilart)
Licensed under the MIT license.