1 | const separator = " ~ ";
|
2 | const chalk = require("chalk");
|
3 |
|
4 | const { prompt } = require("enquirer");
|
5 | const optionList = async () => {
|
6 | let choiceCategories = [
|
7 | {
|
8 | name: "start",
|
9 | message: "Choose category then task to run"
|
10 | },
|
11 | {
|
12 | name: "list",
|
13 | message: "Select any task with text autocompletion"
|
14 | },
|
15 | {
|
16 | name: "scripts",
|
17 | message: "Choose a script from package.json"
|
18 | },
|
19 | {
|
20 | name: "upgrade",
|
21 | message: "Upgrade all your packages except ones specified by 'ignore-upgrade':[]"
|
22 | },
|
23 | {
|
24 | name: "bump",
|
25 | message: "Bump package.json and beautify it!"
|
26 | },
|
27 | {
|
28 | name: "encryption",
|
29 | message: "Encrypt/Decrypt secret files"
|
30 | },
|
31 | {
|
32 | name: "clear",
|
33 | message: "Clear recent task history"
|
34 | },
|
35 | {
|
36 | name: "generate",
|
37 | message: "Generate a sample fscripts.md file from the package.json"
|
38 | },
|
39 | {
|
40 | name: "toc",
|
41 | message: "Generate updated Table of Contents on top of the fscripts.md file"
|
42 | },
|
43 | {
|
44 | name: "--help",
|
45 | message: "See full help documentation"
|
46 | }
|
47 | ];
|
48 | try {
|
49 | let { answer } = await prompt({
|
50 | type: "select",
|
51 | name: `answer`,
|
52 | choiceMessage: e => {
|
53 |
|
54 |
|
55 | return chalk.bold.underline.black(e.name + ":" + chalk.gray(" " + e.message));
|
56 | },
|
57 | message: `${chalk.cyan.bold.underline("Whatz category do you want to run?")}`,
|
58 | choices: choiceCategories
|
59 | });
|
60 | return answer;
|
61 | } catch (e) {
|
62 | return false;
|
63 | }
|
64 | };
|
65 |
|
66 | module.exports = optionList;
|