-
Notifications
You must be signed in to change notification settings - Fork 0
/
business-card.js
executable file
·129 lines (112 loc) · 3.34 KB
/
business-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
#!/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()
const prompt = inquirer.createPromptModule()
const info = [
{
type: 'list',
name: 'action',
message: 'What do you want to do?',
choices: [
{
name: `Send me an ${chalk.green.bold('email')}?`,
value: (() => {
open('mailto:thiago.silva@imd.ufrn.br')
console.log('\nDone, I will contact you soon. Thanks!\n')
})
},
{
name: `Download my ${chalk.magentaBright.bold('resume')}?`,
value: (() => {
const loader = ora({
test: 'Downloading resume',
spinner: cliSpinners.material,
}).start()
const url = 'https://github.com/silva-thiago/silva-thiago/blob/master/api/resume'
let pipe = request(url).pipe(fs.createWriteStream('./thiago-silva-resume.html'))
pipe.on('finish', (() => {
let downloadPath = path.join(process.cwd(), 'thiago-silva-resume.html')
console.log(`\nResume downloaded at ${downloadPath}\n`)
open(downloadPath)
loader.stop()
}))
})
},
{
name: 'Just quit.',
value: (() => {
console.log('I hope you enjoyed it! Have a nice day!')
})
}
]
}
]
const data = {
name: chalk.bold.green(' Thiago Silva'),
handle: chalk.white('@silva-thiago'),
work: `${chalk.white('Front-end developer at')} ${chalk
.hex('#2b82b2')
.bold('STI UFRN & DTI IMD')}`,
github: chalk.gray('https://github.com/') + chalk.green('silva-thiago'),
linkedin: chalk.gray('https://linkedin.com/in/') + chalk.blue('s-thiago'),
telegram: chalk.gray('https://t.me/') + chalk.cyan('silvathiago'),
web: chalk.cyanBright('https://silva-thiago.github.io'),
npx: chalk.red('npx') + ' ' + chalk.white('thiagosilva'),
labelWork: chalk.white.bold(' Work:'),
labelGitHub: chalk.white.bold(' GitHub:'),
labelLinkedIn: chalk.white.bold(' LinkedIn:'),
labelTelegram: chalk.white.bold(' Telegram:'),
labelWeb: chalk.white.bold(' Web:'),
labelCard: chalk.white.bold(' Card:')
}
const me = boxen(
[
`${data.name}`,
``,
`${data.labelWork} ${data.work}`,
``,
`${data.labelGitHub} ${data.github}`,
`${data.labelLinkedIn} ${data.linkedin}`,
`${data.labelTelegram} ${data.telegram}`,
`${data.labelWeb} ${data.web}`,
``,
`${data.labelCard} ${data.npx}`,
``,
/* `${chalk.italic(
'I am currently looking for new opportunities,'
)}`, */
`${chalk.italic('My inbox is always open.')}`,
`${chalk.italic(
'Whether you have a question or just want to say hi.'
)}`,
`${chalk.italic(
'I will try my best to get back to you!'
)}`
].join('\n'),
{
borderColor: 'green',
borderStyle: 'single',
float: 'center',
margin: 1,
padding: 1
}
)
console.log(me)
const tip = [
`Tip: Try ${chalk.cyanBright.bold(
'cmd/ctrl + click'
)} on the links above.`,
'',
].join('\n')
console.log(tip)
prompt(info).then(answer => answer.action())