How to use the ansi-escapes.cursorHide 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 serverless / components / src / utils / getCli.js View on Github external
render: async (frame = 0) => {
        const nextFrame = ++frame
        const second = String(Math.floor(nextFrame / 10) + 1) // cause we're running at 10 frames per second
        let coloredStage

        if (['dev', 'development'].includes(stage)) {
          coloredStage = chalk.green(stage)
        } else if (['prod', 'production'].includes(stage)) {
          coloredStage = chalk.red(stage)
        } else {
          coloredStage = chalk.yellow(stage)
        }

        cli.write(
          `${ansiEscapes.cursorHide +
            ansiEscapes.cursorLeft +
            ansiEscapes.eraseDown}\n  ${chalk.grey(
            `${second}s ${figures.pointerSmall}`
          )} ${coloredStage} ${chalk.grey(figures.pointerSmall)} ${componentName} ${chalk.grey(
            figures.pointerSmall
          )} ${chalk.yellow(cli.msg)}\n${ansiEscapes.cursorLeft + ansiEscapes.cursorUp(2)}`
        )
        if (!cli.running) {
          cli.write(
            `${ansiEscapes.cursorShow + ansiEscapes.cursorLeft + ansiEscapes.cursorDown(2)}\n`
          )
          return
        }
        await sleep(100)
        cli.render(nextFrame)
      },
github serverless / components / src / cli / Context.js View on Github external
start() {
    // Hide cursor, to keep it clean
    process.stdout.write(ansiEscapes.cursorHide)

    if (this._.debug) {
      // Create a white space immediately
      this.log()
    }

    // Start counting seconds
    setInterval(() => {
      this._.timerSeconds = Math.floor((Date.now() - this._.timerStarted) / 1000)
    }, 1000)

    // Set Event Handler: Control + C to cancel session
    process.on('SIGINT', async () => {
      return this.close('cancel')
    })
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 jdxcode / password-prompt / index.js View on Github external
function stop () {
        if (maskAfter) {
          stderr.write(ansi.cursorHide + ansi.cursorLeft + ask + input.replace(/./g, '*') + '\n' + ansi.cursorShow)
        } else {
          stderr.write('\n')
        }
        stdin.removeListener('data', fn)
        stdin.setRawMode(false)
        stdin.pause()
      }
github voidcosmos / npkill / src / controller.ts View on Github external
private hideCursor(): void {
    this.print(ansiEscapes.cursorHide);
  }
github derhuerst / multiselect-prompt / index.js View on Github external
, render: function (first) {
		if (first) this.out.write(esc.cursorHide)

		let prompt = [
			  ui.symbol(this.done, this.aborted)
			, chalk.bold(this.msg)
			, this.done ? '' : chalk.gray(this.hint)
		].join(' ')

		if (!this.done) {
			const c = this.cursor
			prompt += '\n' + this.value.map((v, i) =>
				(v.selected ? chalk.green(figures.tick) : ' ') + ' '
				+ (c === i ? chalk.cyan.underline(v.title) : v.title)
			).join('\n')
		}

		this.out.write(ui.clear(this.lastRendered) + prompt)
github heroku / heroku-cli-util / lib / prompt.js View on Github external
function stop () {
      if (!options.hide) {
        stderr.write(
          ansi.cursorHide +
            ansi.cursorLeft +
            options.prompt +
            input.replace(/./g, '*') +
            '\n' +
            ansi.cursorShow)
      } else {
        stderr.write('\n')
      }
      stdin.removeListener('data', fn)
      stdin.setRawMode(false)
      stdin.pause()
    }
github derhuerst / sms-cli / ui.js View on Github external
render: function (first) {
		if (first) this.out.write('\n'.repeat(height))
		if (this.querying) return

		let out = esc.clearScreen + esc.cursorTo(0, 0)
			+ this.renderStatus() + '\n'

		if (this.messages.length === 0) {
		} else if (this.message) {
			out += this.renderMessage()
		} else {
			out += this.renderMessages()
		}

		out += '\n' + this.renderBindings()
		this.out.write(out + esc.cursorHide)
	}
}