How to use the ansi-escapes.cursorUp function in ansi-escapes

To help you get started, we’ve selected a few ansi-escapes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github heroku / cli / packages / ci / src / utils / test-run.ts View on Github external
)
  })

  cli.table(data, {
    printHeader: undefined,
    columns: [
      {key: 'iconStatus', width: 1, label: ''}, // label '' is to make sure that widh is 1 character
      {key: 'number', label: ''},
      {key: 'branch'},
      {key: 'sha'},
      {key: 'status'}
    ]
  })

  if (watchOption) {
    process.stdout.write(ansiEscapes.cursorUp(latestTestRuns.length))
  }
}
github serverless / components / src / cli / index.js View on Github external
if (this._.useTimer) {
      content += ` ${grey(this._.seconds + 's')}`
      content += ` ${grey(figures.pointerSmall)}`
    }
    content += ` ${green(this._.stage)}`
    content += ` ${grey(figures.pointerSmall)} ${this._.parentComponent}`
    content += ` ${grey(figures.pointerSmall)} ${grey(this._.status.message)}`
    content += ` ${grey(this._.status.loadingDots)}`
    process.stdout.write(content)
    console.log() // eslint-disable-line

    // Get cursor starting position according to terminal & content width
    const startingPosition = this.getRelativeVerticalCursorPosition(content)

    // Put cursor to starting position for next view
    process.stdout.write(ansiEscapes.cursorUp(startingPosition))
    process.stdout.write(ansiEscapes.cursorLeft)
  }
github serverless / components / src / cli / Context.js View on Github external
// Write status content
      console.log() // eslint-disable-line
      let content = ''
      if (this._.timer) {
        content += `${grey(this._.timerSeconds + 's')} `
        content += `${grey(figures.pointerSmall)} `
      }
      content += `${this._.entity} `
      content += `${grey(figures.pointerSmall)} ${grey(this._.status)}`
      content += ` ${grey(this._.loadingDots)}`
      process.stdout.write(content)
      console.log() // eslint-disable-line

      // Put cursor to starting position for next view
      const startingPosition = this._getRelativeVerticalCursorPosition(content)
      process.stdout.write(ansiEscapes.cursorUp(startingPosition))
      process.stdout.write(ansiEscapes.cursorLeft)
    }

    await sleep(100)
    return this._renderEngine()
  }
github ericclemmons / node-recorder / src / JestWatchPlugin.ts View on Github external
async run() {
    this.changeMode();

    // Scroll up so that repeated presses of `r` don't spam the console
    process.stdout.write(recorder.getModeBanner() + ansi.cursorUp(7));

    // Set the mode for the next test worker's process
    process.env.RECORDER = recorder.getMode();
  }
};
github sakuli / sakuli / packages / sakuli-cli / src / cli-utils / test-execution-context-renderer.function.ts View on Github external
.on("END_TESTSTEP", s => {
            l(ansiEscapes.cursorUp(1) + ansiEscapes.eraseLine + renderEntityOnEnd(s, 'Step', 3))
        })
        .on("END_TESTCASE", s => l(renderEntityOnEnd(s, 'Testcase', 2)))
github rjrodger / sneeze / sneeze.js View on Github external
function render() {
    var size_host = 4
    var size_meta = 4
    var size_tag = 3

    sortedmembers.forEach(function(m) {
      size_host = Math.max(size_host, m.host.length)
      size_meta = Math.max(size_meta, m.meta.length)
      size_tag = Math.max(size_tag, m.tag.length)
    })

    var nm = sortedmembers.length

    w(AE.clearScreen)
    w(AE.cursorHide)
    w(AE.cursorUp(nm + 2))
    w(AE.eraseDown)

    console.log(
      head(
        [
          Pad('host', size_host),
          Pad(2, 'a'),
          Pad(2, 'r'),
          Pad(2, 's'),
          Pad(8, 'time'),
          Pad('tag', size_tag),
          Pad('meta', size_meta),
          'id'
        ].join(' ')
      )
    )
github channg / coir / bin / process.js View on Github external
function cleanCmd(out) {
  let overLine = getLineOf(true,out)
  let count = getRexCount("\n", staticArray.check[checkArray.length].tip)
  count += overLine
  if (!out) {
    process.stdout.write(ansiEscapes.cursorUp(count + 1) + ansiEscapes.eraseDown)
  } else {
    if (canReWrite) {
      if (againList.length > 1) {
        process.stdout.write(ansiEscapes.cursorUp(count + 3) + ansiEscapes.eraseDown)
      } else {
        process.stdout.write(ansiEscapes.cursorUp(count + 2) + ansiEscapes.eraseDown)
      }
      tips()
      process.stdout.write(`(${out})\n`)
    } else {
      if (againList.length > 1) {
        process.stdout.write(ansiEscapes.cursorUp(count + 2) + ansiEscapes.eraseDown)
      } else {
        process.stdout.write(ansiEscapes.cursorUp(count + 1) + ansiEscapes.eraseDown)
      }
      tips()
      process.stdout.write(`(${out})\n`)
    }
  }
}
github dylang / observatory / lib / observatory.js View on Github external
function update() {
        var output = task.render();
        var change = currentLine - task.line;
        out.write(position.cursorUp(change));
        out.write(output);
        out.write(position.cursorDown(change - (out.height(output) - 1)));
        out.write(position.cursorBackward(out.ln(output)));
        return task;
    }