natureco-cli 2.23.5 → 2.23.7

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/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "2.23.5",
3
+ "version": "2.23.7",
4
4
  "description": "NatureCo AI Bot Terminal Interface",
5
- "main": "bin/natureco.js",
6
5
  "bin": {
7
- "natureco": "./bin/natureco.js"
6
+ "natureco": "bin/natureco.js"
8
7
  },
9
8
  "files": [
10
9
  "bin/",
@@ -24,6 +23,7 @@
24
23
  "author": "NatureCo",
25
24
  "license": "MIT",
26
25
  "dependencies": {
26
+ "@inquirer/prompts": "^8.5.0",
27
27
  "@whiskeysockets/baileys": "^7.0.0-rc10",
28
28
  "chalk": "^4.1.2",
29
29
  "commander": "^11.1.0",
@@ -1,13 +1,32 @@
1
- let _inquirer;
1
+ const { select, input, password, confirm } = require('@inquirer/prompts');
2
2
 
3
- module.exports = new Proxy({}, {
4
- get(_, prop) {
5
- if (prop === 'prompt') {
6
- return async (...args) => {
7
- if (!_inquirer) _inquirer = (await import('inquirer')).default;
8
- return _inquirer.prompt(...args);
9
- };
3
+ module.exports = {
4
+ async prompt(questions) {
5
+ const results = {};
6
+ for (const q of questions) {
7
+ if (q.type === 'list') {
8
+ results[q.name] = await select({
9
+ message: q.message,
10
+ choices: q.choices.map(c =>
11
+ typeof c === 'string' ? { value: c, name: c } : c
12
+ )
13
+ });
14
+ } else if (q.type === 'password') {
15
+ results[q.name] = await password({ message: q.message, mask: q.mask });
16
+ } else if (q.type === 'checkbox') {
17
+ const { checkbox } = require('@inquirer/prompts');
18
+ results[q.name] = await checkbox({
19
+ message: q.message,
20
+ choices: q.choices.map(c =>
21
+ typeof c === 'string' ? { value: c, name: c } : c
22
+ )
23
+ });
24
+ } else if (q.type === 'confirm') {
25
+ results[q.name] = await confirm({ message: q.message, default: q.default });
26
+ } else {
27
+ results[q.name] = await input({ message: q.message, default: q.default });
28
+ }
10
29
  }
11
- return undefined;
30
+ return results;
12
31
  }
13
- });
32
+ };