mirror of
https://github.com/actions/labeler
synced 2026-05-10 16:01:02 +02:00
build
This commit is contained in:
13
node_modules/prompts/lib/util/action.js
generated
vendored
13
node_modules/prompts/lib/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';
|
||||
@@ -8,6 +10,11 @@ module.exports = key => {
|
||||
if (key.name === 'e') return 'last';
|
||||
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,6 +25,10 @@ module.exports = key => {
|
||||
if (key.name === 'tab') return 'next';
|
||||
if (key.name === 'pagedown') return 'nextPage';
|
||||
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';
|
||||
|
||||
2
node_modules/prompts/lib/util/clear.js
generated
vendored
2
node_modules/prompts/lib/util/clear.js
generated
vendored
@@ -14,5 +14,5 @@ module.exports = function(prompt, perLine = process.stdout.columns) {
|
||||
rows += 1 + Math.floor(Math.max(width(line) - 1, 0) / perLine);
|
||||
}
|
||||
|
||||
return (erase.line + cursor.prevLine()).repeat(rows - 1) + erase.line + cursor.to(0);
|
||||
return erase.lines(rows);
|
||||
};
|
||||
|
||||
21
node_modules/prompts/lib/util/entriesToDisplay.js
generated
vendored
Normal file
21
node_modules/prompts/lib/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/lib/util/index.js
generated
vendored
5
node_modules/prompts/lib/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')
|
||||
};
|
||||
|
||||
11
node_modules/prompts/lib/util/lines.js
generated
vendored
Normal file
11
node_modules/prompts/lib/util/lines.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
'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);
|
||||
};
|
||||
27
node_modules/prompts/lib/util/wrap.js
generated
vendored
Normal file
27
node_modules/prompts/lib/util/wrap.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'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