-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
69 lines (60 loc) · 1.85 KB
/
index.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env node
var inquirer = require("inquirer");
var chalk = require("chalk");
const title = chalk.bold.red;
const response = chalk.blue;
var resume = require("./helpers/resume.json");
var dividerConstructor = require("./helpers/divider.js");
var divider = new dividerConstructor(70, "green");
var resumePrompts = {
type: "list",
name: "resumeOptions",
message: "What do you want to know about me?",
choices: [...Object.keys(resume), "Exit"]
};
function resumeHandler() {
console.log("Hello,My name is Nipul Singal and welcome to my resume.");
inquirer.prompt(resumePrompts).then(answer => {
if (answer.resumeOptions == "Exit") {
return;
}
var option = answer.resumeOptions;
divider.printTop();
resume[`${option}`].forEach((info, ind) => {
if (typeof info === "string") {
console.log(divider.containString(` ${info}`, response));
} else {
Object.values(info).forEach((value, ind) => {
if (ind > 1) {
console.log(divider.containString(` ${value}`, response));
} else if (ind == 1) {
console.log(divider.containString(` ${value}`, chalk.cyan.bold));
} else {
console.log(divider.containString(` ${value.padEnd(38)}`, title));
}
});
ind !== resume[`${option}`].length - 1 && divider.printLine();
}
});
divider.printBottom();
inquirer
.prompt({
type: "list",
name: "exitBack",
message: "Go back or Exit?",
choices: ["Back", "Exit"]
})
.then(choice => {
if (choice.exitBack == "Back") {
process.stdout.write("\033c");
resumeHandler();
} else {
return;
}
});
});
}
(() => {
console.clear();
resumeHandler();
})();