mirror of
https://github.com/actions/labeler
synced 2026-05-10 18:01:01 +02:00
build
This commit is contained in:
52
node_modules/prompts/dist/elements/date.js
generated
vendored
52
node_modules/prompts/dist/elements/date.js
generated
vendored
@@ -11,8 +11,7 @@ const Prompt = require('./prompt');
|
||||
const _require = require('../util'),
|
||||
style = _require.style,
|
||||
clear = _require.clear,
|
||||
figures = _require.figures,
|
||||
strip = _require.strip;
|
||||
figures = _require.figures;
|
||||
|
||||
const _require2 = require('sisteransi'),
|
||||
erase = _require2.erase,
|
||||
@@ -56,20 +55,19 @@ const dfltLocales = {
|
||||
monthsShort: 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'.split(','),
|
||||
weekdays: 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday'.split(','),
|
||||
weekdaysShort: 'Sun,Mon,Tue,Wed,Thu,Fri,Sat'.split(',')
|
||||
/**
|
||||
* DatePrompt Base Element
|
||||
* @param {Object} opts Options
|
||||
* @param {String} opts.message Message
|
||||
* @param {Number} [opts.initial] Index of default value
|
||||
* @param {String} [opts.mask] The format mask
|
||||
* @param {object} [opts.locales] The date locales
|
||||
* @param {String} [opts.error] The error message shown on invalid value
|
||||
* @param {Function} [opts.validate] Function to validate the submitted value
|
||||
* @param {Stream} [opts.stdin] The Readable stream to listen to
|
||||
* @param {Stream} [opts.stdout] The Writable stream to write readline data to
|
||||
*/
|
||||
|
||||
};
|
||||
/**
|
||||
* DatePrompt Base Element
|
||||
* @param {Object} opts Options
|
||||
* @param {String} opts.message Message
|
||||
* @param {Number} [opts.initial] Index of default value
|
||||
* @param {String} [opts.mask] The format mask
|
||||
* @param {object} [opts.locales] The date locales
|
||||
* @param {String} [opts.error] The error message shown on invalid value
|
||||
* @param {Function} [opts.validate] Function to validate the submitted value
|
||||
* @param {Stream} [opts.stdin] The Readable stream to listen to
|
||||
* @param {Stream} [opts.stdout] The Writable stream to write readline data to
|
||||
*/
|
||||
|
||||
class DatePrompt extends Prompt {
|
||||
constructor(opts = {}) {
|
||||
@@ -231,28 +229,16 @@ class DatePrompt extends Prompt {
|
||||
|
||||
render() {
|
||||
if (this.closed) return;
|
||||
if (this.firstRender) this.out.write(cursor.hide);else this.out.write(erase.lines(1));
|
||||
super.render();
|
||||
let clear = erase.line + (this.lines ? erase.down(this.lines) : '') + cursor.to(0);
|
||||
this.lines = 0;
|
||||
let error = '';
|
||||
if (this.firstRender) this.out.write(cursor.hide);else this.out.write(clear(this.outputText));
|
||||
super.render(); // Print prompt
|
||||
|
||||
this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(false), this.parts.reduce((arr, p, idx) => arr.concat(idx === this.cursor && !this.done ? color.cyan().underline(p.toString()) : p), []).join('')].join(' '); // Print error
|
||||
|
||||
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;
|
||||
} // Print prompt
|
||||
|
||||
|
||||
let prompt = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(false), this.parts.reduce((arr, p, idx) => arr.concat(idx === this.cursor && !this.done ? color.cyan().underline(p.toString()) : p), []).join('')].join(' ');
|
||||
let position = '';
|
||||
|
||||
if (this.lines) {
|
||||
position += cursor.up(this.lines);
|
||||
position += cursor.left + cursor.to(strip(prompt).length);
|
||||
this.outputText += this.errorMsg.split('\n').reduce((a, l, i) => a + `\n${i ? ` ` : figures.pointerSmall} ${color.red().italic(l)}`, ``);
|
||||
}
|
||||
|
||||
this.out.write(clear + prompt + error + position);
|
||||
this.out.write(erase.line + cursor.to(0) + this.outputText);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user