UNPKG

1.58 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = exports.KEYS = void 0;
7
8function _chalk() {
9 const data = _interopRequireDefault(require("chalk"));
10
11 _chalk = function () {
12 return data;
13 };
14
15 return data;
16}
17
18function _cliTools() {
19 const data = require("@react-native-community/cli-tools");
20
21 _cliTools = function () {
22 return data;
23 };
24
25 return data;
26}
27
28function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
30const KEYS = {
31 FIX_ALL_ISSUES: 'f',
32 FIX_ERRORS: 'e',
33 FIX_WARNINGS: 'w',
34 EXIT: '\r'
35};
36exports.KEYS = KEYS;
37
38const printOption = option => _cliTools().logger.log(` \u203A ${option}`);
39
40const printOptions = () => {
41 _cliTools().logger.log();
42
43 _cliTools().logger.log(_chalk().default.bold('Usage'));
44
45 printOption(`${_chalk().default.dim('Press')} ${KEYS.FIX_ALL_ISSUES} ${_chalk().default.dim('to try to fix issues.')}`);
46 printOption(`${_chalk().default.dim('Press')} ${KEYS.FIX_ERRORS} ${_chalk().default.dim('to try to fix errors.')}`);
47 printOption(`${_chalk().default.dim('Press')} ${KEYS.FIX_WARNINGS} ${_chalk().default.dim('to try to fix warnings.')}`);
48 printOption(`${_chalk().default.dim('Press')} Enter ${_chalk().default.dim('to exit.')}`);
49};
50
51var _default = (_ref) => {
52 let {
53 onKeyPress
54 } = _ref;
55 printOptions();
56
57 if (process.stdin.setRawMode) {
58 process.stdin.setRawMode(true);
59 }
60
61 process.stdin.resume();
62 process.stdin.setEncoding('utf8');
63 process.stdin.on('data', onKeyPress);
64};
65
66exports.default = _default;
\No newline at end of file