-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.js
executable file
·49 lines (44 loc) · 1.17 KB
/
cli.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env node
const shell = require("shelljs");
const inquirer = require("inquirer");
const shellMagic = require("./shellMagic");
/**
* Checkbox list examples
*/
const VUE_COMPONENT_FOLDER = "Vue component Folder";
const VUE_COMPONENT_SINGLE = "Single page vue component";
const entryChoices = [VUE_COMPONENT_FOLDER, VUE_COMPONENT_SINGLE];
const extras = ["add vuex module to store folder"];
inquirer
.prompt([
{
type: "input",
name: "componentName",
message: "What's the name of your component?"
},
{
type: "input",
name: "pathName",
message: "What is your intended path? Leave blank for current root"
},
{
type: "list",
name: "genType",
message: "What would you like to generate?",
paginated: true,
choices: entryChoices
}
])
.then(answers => {
switch (answers.genType) {
case VUE_COMPONENT_FOLDER:
shellMagic.makeFolder(answers.componentName, answers.pathName);
break;
case VUE_COMPONENT_SINGLE:
shellMagic.makeSingle(answers.componentName, answers.pathName);
break;
default:
break;
}
console.log("All done!");
});