-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
84 lines (70 loc) · 1.9 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env node
import chalk from "chalk";
import inquirer from "inquirer";
import gradient from "gradient-string";
import chalkAnimation from "chalk-animation";
import figlet from "figlet";
import { createSpinner } from "nanospinner";
let playerName;
const wait = (ms = 2000) => new Promise((resolve) => setTimeout(resolve, ms));
async function welcomeScreen() {
const msg = "Parbez";
figlet(msg, (err, data) => {
console.log(gradient.pastel.multiline(data));
});
await wait();
}
async function welcome() {
const rainbowTitle = chalkAnimation.rainbow(
"Hi, I'm Parbez. \nWelcome to my cli game!\n"
);
await wait();
rainbowTitle.stop();
console.log(`
${chalk.bgGreen(chalk.red("My Introduction"))}
I'm a ${chalk.green("self-taught")} developer.
Software Engineer specialized in ${chalk.blue("Node.js")} and ${chalk.bgBlue(
"Typescript"
)}.
Full stack web and app developer.
Ethical Hacker and Pentester.
`);
}
async function askName() {
const answer = await inquirer.prompt({
name: "playerName",
type: "input",
message: "What's your name?",
default() {
return "Player";
},
});
playerName = answer.playerName;
}
await welcomeScreen();
await welcome();
await askName();
console.log(
`${chalk.bgGreen(chalk.red(`Hi ${playerName}!`))}
Nice to meet you!
`
);
async function chooseOne() {
const answer = await inquirer.prompt({
name: "chooseOne",
type: "list",
message: "Select a option to go to my profile",
choices: ["My Github", "My Discord"],
});
return handleAnswer(answer.chooseOne);
}
async function handleAnswer(ans) {
const spinner = createSpinner("Generating profile link...").start();
await wait();
const profileLink =
ans === "My Github" ? "https://github.com/imranbarbhuiya" : "P<z, x>#1572";
spinner.success({
text: `Profile link generated successfully!\n${profileLink}`,
});
}
await chooseOne();