setCursorPosition

import { setCursorPosition } from "jsr:@ende/cli/unstable-ansi";

function ยท experimental

function setCursorPosition(x: number = 1, y: number = 1): string

Sets cursor position to x line and y column or up to the margin. Lines and columns begin at 1 not 0.

x: number = 1

The line to move to.

y: number = 1

The column to move to.

Returns

The ANSI escape code for setting the cursor position.

Example: Usage

import * as Ansi from "@ende/cli/unstable-ansi";

console.log(
  Ansi.setCursorPosition(5, 2) +
  Ansi.ERASE_LINE +
  "Hello World!",
);

Source