mirror of
https://github.com/actions/labeler
synced 2026-05-10 18:11:03 +02:00
build
This commit is contained in:
30
node_modules/prompts/dist/elements/text.js
generated
vendored
30
node_modules/prompts/dist/elements/text.js
generated
vendored
@@ -9,12 +9,13 @@ const color = require('kleur');
|
||||
const Prompt = require('./prompt');
|
||||
|
||||
const _require = require('sisteransi'),
|
||||
erase = _require.erase,
|
||||
cursor = _require.cursor;
|
||||
|
||||
const _require2 = require('../util'),
|
||||
style = _require2.style,
|
||||
clear = _require2.clear,
|
||||
strip = _require2.strip,
|
||||
lines = _require2.lines,
|
||||
figures = _require2.figures;
|
||||
/**
|
||||
* TextPrompt Base Element
|
||||
@@ -191,28 +192,21 @@ class TextPrompt extends Prompt {
|
||||
|
||||
render() {
|
||||
if (this.closed) return;
|
||||
|
||||
if (!this.firstRender) {
|
||||
if (this.outputError) this.out.write(cursor.down(lines(this.outputError) - 1) + clear(this.outputError));
|
||||
this.out.write(clear(this.outputText));
|
||||
}
|
||||
|
||||
super.render();
|
||||
let erase = (this.lines ? cursor.down(this.lines) : ``) + this.clear;
|
||||
this.lines = 0;
|
||||
let prompt = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), this.red ? color.red(this.rendered) : this.rendered].join(` `);
|
||||
let error = ``;
|
||||
this.outputError = '';
|
||||
this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), this.red ? color.red(this.rendered) : this.rendered].join(` `);
|
||||
|
||||
if (this.error) {
|
||||
let lines = this.errorMsg.split(`\n`);
|
||||
error += lines.reduce((a, l, i) => a += `\n${i ? ' ' : figures.pointerSmall} ${color.red().italic(l)}`, ``);
|
||||
this.lines = lines.length;
|
||||
this.outputError += this.errorMsg.split(`\n`).reduce((a, l, i) => a + `\n${i ? ' ' : figures.pointerSmall} ${color.red().italic(l)}`, ``);
|
||||
}
|
||||
|
||||
let position = ``;
|
||||
|
||||
if (this.lines) {
|
||||
position += cursor.up(this.lines);
|
||||
position += cursor.left + cursor.to(strip(prompt).length);
|
||||
}
|
||||
|
||||
position += cursor.move(this.placeholder ? -this.initial.length * this.scale : -this.rendered.length + this.cursor * this.scale);
|
||||
this.out.write(erase + prompt + error + position);
|
||||
this.clear = clear(prompt + error);
|
||||
this.out.write(erase.line + cursor.to(0) + this.outputText + cursor.save + this.outputError + cursor.restore);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user