MCPcopy Create free account
hub / github.com/denoland/std / write

Method write

cli/unstable_static_line.ts:91–106  ·  view source on GitHub ↗

* Overwrites the contents of the line. * * @param line The new content to write. * @returns A promise that resolves when the line is written. * * @example Usage * ```ts ignore * import { delay } from "@std/async/delay"; * import { StaticLine } from "@std/cli/unstable-static-l

(line: string)

Source from the content-addressed store, hash-verified

89 * ```
90 */
91 async write(line: string): Promise<void> {
92 if (this.#released) throw new ReferenceError("Line has been released");
93 await write(
94 Ansi.SAVE_CURSOR +
95 Ansi.DISABLE_ORIGIN_MODE +
96 Ansi.DISABLE_AUTO_WRAP +
97 Ansi.setCursorPosition(
98 this.#atTop
99 ? linesAtTop.indexOf(this.#id) + 1
100 : getRows() - linesAtBottom.indexOf(this.#id),
101 ) +
102 Ansi.ERASE_LINE +
103 line +
104 Ansi.RESTORE_CURSOR,
105 );
106 }
107
108 /**
109 * Releases the line so other content can use it.

Callers

nothing calls this directly

Calls 1

writeFunction · 0.50

Tested by

no test coverage detected