generated from beyourahi/npx_card
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcard.js
147 lines (132 loc) · 4.81 KB
/
card.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/usr/bin/env node
"use strict";
const boxen = require("boxen");
const chalk = require("chalk");
const inquirer = require("inquirer");
const clear = require("clear");
const open = require("open");
const fs = require("fs");
// const request = require("request");
const path = require("path");
// const ora = require("ora");
// const cliSpinners = require("cli-spinners");
clear();
//! importing User Data from data.json
const res = fs.readFileSync(path.resolve(__dirname, "data.json"));
const user_data = JSON.parse(res);
const {
user_name,
user_email,
twitter_username,
linkedin_username,
github_username,
npx_card_handle,
job_title,
leetcode_username,
instagram_username,
portfolio_username,
} = user_data;
const prompt = inquirer.createPromptModule();
const questions = [
{
type: "list",
name: "action",
message: "What you want to do?",
choices: [
//// Send an email
{
name: `Send me an ${chalk.green.bold("email")}?`,
value: () => {
open(`mailto:${user_email}`);
console.log("\nDone, see you soon at inbox.\n");
},
},
//// Download Resume
// {
// name: `Download my ${chalk.magentaBright.bold("Resume")}?`,
// value: () => {
// // cliSpinners.dots;
// const loader = ora({
// text: " Downloading Resume",
// spinner: cliSpinners.material,
// }).start();
// let pipe = request(`${resume_url}`).pipe(
// fs.createWriteStream(`./${npx_card_handle}-resume.html`)
// );
// pipe.on("finish", function () {
// let downloadPath = path.join(
// process.cwd(),
// `${npx_card_handle}-resume.html`
// );
// console.log(`\nResume Downloaded at ${downloadPath} \n`);
// open(downloadPath);
// loader.stop();
// });
// },
// },
// //// Quit
{
name: "Just quit.",
value: () => {
console.log("Good bye :)\n");
},
},
],
},
];
const data = {
name: chalk.bold.green(` ${user_name}`),
// work: `${chalk.white("Software Engineer at")} ${chalk.hex("#2b82b2").bold("ClearTax")}`,
work: `${chalk.white(`${job_title}`)}`,
twitter: chalk.gray("https://twitter.com/") + chalk.cyan(`${twitter_username}`),
github: chalk.gray("https://github.com/") + chalk.green(`${github_username}`),
linkedin: chalk.gray("https://linkedin.com/in/") + chalk.blue(`${linkedin_username}`),
leetcode : chalk.gray("https://leetcode.com/") + chalk.blue(`${leetcode_username}`),
instagram: chalk.gray("https://instagram.com/") + chalk.magenta(`${instagram_username}`),
portfolio : chalk.gray("https://") + chalk.magenta(`${portfolio_username}`),
web: chalk.cyan(`${portfolio_username}`),
npx: chalk.red("npx") + " " + chalk.white(`${npx_card_handle}`),
labelWork: chalk.white.bold(" Work:"),
labelTwitter: chalk.white.bold(" Twitter:"),
labelGitHub: chalk.white.bold(" GitHub:"),
labelLinkedIn: chalk.white.bold(" LinkedIn:"),
labelleetcode: chalk.white.bold(" leetcode:"),
labelinstagram: chalk.white.bold(" instagram:"),
labelportfolio: chalk.white.bold(" portfolio:"),
labelWeb: chalk.white.bold(" Web:"),
labelCard: chalk.white.bold(" Card:"),
};
const me = boxen(
[
`${data.name}`,
``,
`${data.labelWork} ${data.work}`,
``,
`${data.labelTwitter} ${data.twitter}`,
`${data.labelGitHub} ${data.github}`,
`${data.labelLinkedIn} ${data.linkedin}`,
`${data.labelWeb} ${data.web}`,
``,
`${data.labelCard} ${data.npx}`,
``,
`${data.labelleetcode} ${data.leetcode}`,
``,
`${data.labelinstagram} ${data.instagram}`,
``,
`${data.labelportfolio} ${data.portfolio}`,
``,
`${chalk.italic("I am currently looking for new opportunities,")}`,
`${chalk.italic("my inbox is always open. Whether you have a")}`,
`${chalk.italic("question or just want to say hi, I will try ")}`,
`${chalk.italic("my best to get back to you!")}`,
].join("\n"),
{
margin: 1,
float: "center",
padding: 1,
borderStyle: "single",
borderColor: "green",
}
);
console.log(me);
prompt(questions).then(answer => answer.action());