mirror of
https://github.com/actions/labeler
synced 2026-05-13 20:21:10 +02:00
build
This commit is contained in:
15
node_modules/prompts/dist/util/action.js
generated
vendored
15
node_modules/prompts/dist/util/action.js
generated
vendored
@@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = key => {
|
||||
module.exports = (key, isSelect) => {
|
||||
if (key.meta) return;
|
||||
|
||||
if (key.ctrl) {
|
||||
if (key.name === 'a') return 'first';
|
||||
if (key.name === 'c') return 'abort';
|
||||
@@ -9,6 +11,11 @@ module.exports = key => {
|
||||
if (key.name === 'g') return 'reset';
|
||||
}
|
||||
|
||||
if (isSelect) {
|
||||
if (key.name === 'j') return 'down';
|
||||
if (key.name === 'k') return 'up';
|
||||
}
|
||||
|
||||
if (key.name === 'return') return 'submit';
|
||||
if (key.name === 'enter') return 'submit'; // ctrl + J
|
||||
|
||||
@@ -18,7 +25,11 @@ module.exports = key => {
|
||||
if (key.name === 'escape') return 'abort';
|
||||
if (key.name === 'tab') return 'next';
|
||||
if (key.name === 'pagedown') return 'nextPage';
|
||||
if (key.name === 'pageup') return 'prevPage';
|
||||
if (key.name === 'pageup') return 'prevPage'; // TODO create home() in prompt types (e.g. TextPrompt)
|
||||
|
||||
if (key.name === 'home') return 'home'; // TODO create end() in prompt types (e.g. TextPrompt)
|
||||
|
||||
if (key.name === 'end') return 'end';
|
||||
if (key.name === 'up') return 'up';
|
||||
if (key.name === 'down') return 'down';
|
||||
if (key.name === 'right') return 'right';
|
||||
|
||||
2
node_modules/prompts/dist/util/clear.js
generated
vendored
2
node_modules/prompts/dist/util/clear.js
generated
vendored
@@ -36,5 +36,5 @@ module.exports = function (prompt, perLine = process.stdout.columns) {
|
||||
}
|
||||
}
|
||||
|
||||
return (erase.line + cursor.prevLine()).repeat(rows - 1) + erase.line + cursor.to(0);
|
||||
return erase.lines(rows);
|
||||
};
|
||||
21
node_modules/prompts/dist/util/entriesToDisplay.js
generated
vendored
Normal file
21
node_modules/prompts/dist/util/entriesToDisplay.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
/**
|
||||
* Determine what entries should be displayed on the screen, based on the
|
||||
* currently selected index and the maximum visible. Used in list-based
|
||||
* prompts like `select` and `multiselect`.
|
||||
*
|
||||
* @param {number} cursor the currently selected entry
|
||||
* @param {number} total the total entries available to display
|
||||
* @param {number} [maxVisible] the number of entries that can be displayed
|
||||
*/
|
||||
|
||||
module.exports = (cursor, total, maxVisible) => {
|
||||
maxVisible = maxVisible || total;
|
||||
let startIndex = Math.min(total - maxVisible, cursor - Math.floor(maxVisible / 2));
|
||||
if (startIndex < 0) startIndex = 0;
|
||||
let endIndex = Math.min(startIndex + maxVisible, total);
|
||||
return {
|
||||
startIndex,
|
||||
endIndex
|
||||
};
|
||||
};
|
||||
5
node_modules/prompts/dist/util/index.js
generated
vendored
5
node_modules/prompts/dist/util/index.js
generated
vendored
@@ -5,5 +5,8 @@ module.exports = {
|
||||
clear: require('./clear'),
|
||||
style: require('./style'),
|
||||
strip: require('./strip'),
|
||||
figures: require('./figures')
|
||||
figures: require('./figures'),
|
||||
lines: require('./lines'),
|
||||
wrap: require('./wrap'),
|
||||
entriesToDisplay: require('./entriesToDisplay')
|
||||
};
|
||||
9
node_modules/prompts/dist/util/lines.js
generated
vendored
Normal file
9
node_modules/prompts/dist/util/lines.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
const strip = require('./strip');
|
||||
|
||||
module.exports = function (msg, perLine = process.stdout.columns) {
|
||||
let lines = String(strip(msg) || '').split(/\r?\n/);
|
||||
if (!perLine) return lines.length;
|
||||
return lines.map(l => Math.ceil(l.length / perLine)).reduce((a, b) => a + b);
|
||||
};
|
||||
16
node_modules/prompts/dist/util/wrap.js
generated
vendored
Normal file
16
node_modules/prompts/dist/util/wrap.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
/**
|
||||
* @param {string} msg The message to wrap
|
||||
* @param {object} [opts]
|
||||
* @param {number|string} [opts.margin] Left margin
|
||||
* @param {number} [opts.width] Maximum characters per line including the margin
|
||||
*/
|
||||
|
||||
module.exports = (msg, opts = {}) => {
|
||||
const tab = Number.isSafeInteger(parseInt(opts.margin)) ? new Array(parseInt(opts.margin)).fill(' ').join('') : opts.margin || '';
|
||||
const width = opts.width || process.stdout.columns;
|
||||
return (msg || '').split(/\r?\n/g).map(line => line.split(/\s+/g).reduce((arr, w) => {
|
||||
if (w.length + tab.length >= width || arr[arr.length - 1].length + w.length + 1 < width) arr[arr.length - 1] += ` ${w}`;else arr.push(`${tab}${w}`);
|
||||
return arr;
|
||||
}, [tab]).join('\n')).join('\n');
|
||||
};
|
||||
Reference in New Issue
Block a user