MCPcopy Index your code
hub / github.com/formatjs/formatjs / clearLine

Function clearLine

packages/cli-lib/console_utils.ts:16–32  ·  view source on GitHub ↗
(
  terminal: (typeof process)['stderr']
)

Source from the content-addressed store, hash-verified

14// From:
15// https://github.com/yarnpkg/yarn/blob/53d8004229f543f342833310d5af63a4b6e59c8a/src/reporters/console/util.js
16export async function clearLine(
17 terminal: (typeof process)['stderr']
18): Promise<void> {
19 if (!terminal.hasColors?.()) {
20 if (terminal.isTTY) {
21 // terminal
22 if (terminal.columns > 0) {
23 await writeStderr(`\r${' '.repeat(terminal.columns - 1)}`)
24 }
25 await writeStderr(`\r`)
26 }
27 // ignore piping to file
28 } else {
29 nativeClearLine(terminal, CLEAR_WHOLE_LINE)
30 nativeCursorTo(terminal, 0, undefined)
31 }
32}
33
34type LogLevel = 'debug' | 'warn' | 'error'
35

Callers 2

debugFunction · 0.85
warnFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected