@gravirei/reis 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/reis.js +43 -9
- package/package.json +1 -1
package/bin/reis.js
CHANGED
|
@@ -242,20 +242,54 @@ program.action(async () => {
|
|
|
242
242
|
|
|
243
243
|
if (isInstalled) {
|
|
244
244
|
console.log(chalk.yellow(' ⚠️ REIS is already installed at ~/.rovodev/reis/\n'));
|
|
245
|
-
console.log(chalk.white('
|
|
245
|
+
console.log(chalk.white(' What would you like to do?\n'));
|
|
246
246
|
console.log(chalk.white(' 1) Keep existing installation'));
|
|
247
|
-
console.log(chalk.white(' 2) Reinstall (replace existing files)'));
|
|
248
|
-
console.log(chalk.white(' 3) Show help\n'));
|
|
247
|
+
console.log(chalk.white(' 2) Reinstall (replace existing files)\n'));
|
|
249
248
|
|
|
250
|
-
//
|
|
251
|
-
|
|
249
|
+
// Use inquirer for simple input prompt
|
|
250
|
+
const inquirer = require('inquirer');
|
|
251
|
+
try {
|
|
252
|
+
const { choice } = await inquirer.prompt([
|
|
253
|
+
{
|
|
254
|
+
type: 'input',
|
|
255
|
+
name: 'choice',
|
|
256
|
+
message: 'Choice [1]:',
|
|
257
|
+
default: '1',
|
|
258
|
+
validate: (input) => {
|
|
259
|
+
if (input === '1' || input === '2') {
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
return 'Please enter 1 or 2';
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
]);
|
|
266
|
+
|
|
267
|
+
console.log('');
|
|
268
|
+
|
|
269
|
+
if (choice === '2') {
|
|
270
|
+
console.log(chalk.cyan(' Reinstalling REIS files...\n'));
|
|
271
|
+
const install = require('../lib/install.js');
|
|
272
|
+
// The install module runs automatically
|
|
273
|
+
} else {
|
|
274
|
+
console.log(chalk.green(' ✓ Keeping existing installation\n'));
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// Always show help after
|
|
278
|
+
const helpCmd = require('../lib/commands/help');
|
|
279
|
+
helpCmd();
|
|
280
|
+
|
|
281
|
+
} catch (err) {
|
|
282
|
+
// If inquirer fails (non-interactive), just show help
|
|
283
|
+
console.log(chalk.gray(' Non-interactive mode - showing help...\n'));
|
|
284
|
+
const helpCmd = require('../lib/commands/help');
|
|
285
|
+
helpCmd();
|
|
286
|
+
}
|
|
252
287
|
} else {
|
|
253
288
|
console.log(chalk.green(' Installing REIS files to ~/.rovodev/reis/...\n'));
|
|
289
|
+
// Show help after install
|
|
290
|
+
const helpCmd = require('../lib/commands/help');
|
|
291
|
+
helpCmd();
|
|
254
292
|
}
|
|
255
|
-
|
|
256
|
-
// Show help
|
|
257
|
-
const helpCmd = require('../lib/commands/help');
|
|
258
|
-
helpCmd();
|
|
259
293
|
});
|
|
260
294
|
|
|
261
295
|
// Parse command-line arguments
|
package/package.json
CHANGED