mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-01 01:38:07 +08:00
Major update breaking changes: - ESLint 7.0.0 (https://eslint.org/docs/user-guide/migrating-to-7.0.0) now includes .eslint.rc.js in its list, which is fine for us. Other changes are not applicable for us. - eslint-plugin-mocha (https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/CHANGELOG.md#700-may-13-2020) drops support for ESLint <7, but this CL updates to 7+. Other changes are not applicable for us. DISABLE_THIRD_PARTY_CHECK=Updating ESLint R=petermarshall@chromium.org Change-Id: I7760e084ef87f73a92f9ea4e075fb4c065047f5a Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2534873 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org>
34 lines
1.2 KiB
JavaScript
34 lines
1.2 KiB
JavaScript
'use strict';
|
|
|
|
module.exports = async(value, prompt, context = {}) => {
|
|
let { choices, multiple } = prompt.options;
|
|
let { size, submitted } = prompt.state;
|
|
|
|
let prefix = context.prefix || await prompt.prefix();
|
|
let separator = context.separator || await prompt.separator();
|
|
let message = context.message || await prompt.message();
|
|
|
|
// ? Select your favorite colors >
|
|
// ^ ^ ^
|
|
// prefix message separator
|
|
let promptLine = [prefix, message, separator].filter(Boolean).join(' ');
|
|
prompt.state.prompt = promptLine;
|
|
|
|
let header = context.header || await prompt.header();
|
|
let output = context.format || await prompt.format(value);
|
|
let help = context.help || await prompt.error() || await prompt.hint();
|
|
let body = context.body || await prompt.body();
|
|
let footer = context.footer || await prompt.footer();
|
|
|
|
if (output || !help) promptLine += ' ' + output;
|
|
if (help && !promptLine.includes(help)) promptLine += ' ' + help;
|
|
|
|
if (submitted && choices && multiple && !output && !body) {
|
|
promptLine += prompt.styles.danger('No items were selected');
|
|
}
|
|
|
|
prompt.clear(size);
|
|
prompt.write([header, promptLine, body, footer].filter(Boolean).join('\n'));
|
|
prompt.restore();
|
|
};
|