-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.js
More file actions
executable file
Β·1044 lines (915 loc) Β· 30.4 KB
/
cli.js
File metadata and controls
executable file
Β·1044 lines (915 loc) Β· 30.4 KB
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env node
import chalk from "chalk";
import boxen from "boxen";
import { Command } from "commander";
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
import inquirer from "inquirer";
import qrcode from "qrcode";
import clipboardy from "clipboardy";
import puppeteer from "puppeteer";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Read package.json for version
const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8'));
/**
* Full CLI resume for: Bharathkumar Palanisamy
* - Full-Stack Engineer (JavaScript ecosystem)
* - 5 years professional experience
* - Career gap framed positively with projects / learning
*/
// Resume data structure
export const resumeData = {
personal: {
name: "Bharathkumar Palanisamy",
role: "Full-Stack Engineer (JavaScript / Node.js & React)",
location: "Bengaluru, India",
email: "kumarbharath63@icloud.com",
phone: "+91 8667861408",
linkedin: "https://linkedin.com/in/bharathkumar-palanisamy",
github: "https://github.com/Bharath-code/",
portfolio: "https://bharathkumar.dev"
},
techStack: [
"Node.js", "Express", "TypeScript", "Sveltekit", "React", "Next.js", "Astro", "Tailwind", "shadcnUI",
"Postgres", "MongoDB", "Redis", "Docker", "Kubernetes",
"GraphQL", "REST", "GitHub Actions", "AWS"
],
profile: [
"Full-Stack Engineer with 5 years of professional experience across the JavaScript ecosystem.",
"I build end-to-end web applications and production APIs using Node.js, Express, React/Next.js and modern databases.",
"I took a planned career break to focus on personal priorities while actively upskilling β building personal projects, contributing to open source, and staying current with modern tooling.",
"Now actively seeking to re-enter the workforce and contribute as a focused, production-minded engineer."
].join(" "),
experience: [
{
company: "Accenture",
title: "Full-Stack Engineer",
dates: "2019 β 2021",
bullets: [
"Built an enterprise-level **Code Scan Platform** from scratch that identified vulnerabilities in large-scale applications and suggested potential fixes.",
"Designed and implemented secure, scalable REST APIs with **Node.js, Express, and MongoDB** to handle high-volume scan data.",
"Developed **pixel-perfect frontends** by converting Figma designs into responsive React + Redux dashboards, ensuring design consistency and accessibility.",
"Integrated CI/CD pipelines using **GitHub Actions and Docker**, reducing deployment times by 60% and minimizing production errors.",
"Collaborated with product managers, security teams, and designers to deliver a compliant and enterprise-ready product."
]
},
{
company: "Infosys",
title: "Full-Stack Engineer",
dates: "2015 β 2019",
bullets: [
"Worked with **major national banks** to design and deliver secure, high-performance features for customer-facing applications.",
"Developed backend services in **Node.js/Express with PostgreSQL**, optimized queries, and introduced **Redis caching** to improve performance by 40%.",
"Implemented **authentication flows (JWT, OAuth2)** and role-based access to meet banking compliance and security standards.",
"Converted business requirements and **Figma wireframes into production-grade UIs** using React, HTML5, and CSS3.",
"Collaborated in Agile sprints with QA and frontend teams to deliver new banking modules within strict deadlines."
]
}
],
projects: [
{
name: "Task & Reminder App (Personal)",
desc: "Full-stack productivity app with grouping, reminders, and AI-generated subtasks to help focus and complete work.",
tech: "Next.js β’ Node.js β’ MongoDB β’ TailwindCSS β’ Vercel"
},
{
name: "Tab Focus Chrome Extension",
desc: "Chrome extension to manage open tabs by encouraging focus and closing unused tabs (Manifest V3).",
tech: "JavaScript β’ Chrome Extension APIs"
},
{
name: "Portfolio & Blog",
desc: "Personal portfolio built to showcase projects and write technical posts about modern JS tooling.",
tech: "SvelteKit β’ Vercel β’ Markdown"
}
],
leadership: [
"Mentored junior developers and reviewed PRs to improve code quality.",
"Collaborated cross-functionally with QA and designers to ship polished features."
],
openSource: [
"Small npm package published for internal CI helpers.",
"Contributed documentation fixes and small patches to open-source JavaScript libraries."
],
education: [
{
degree: "B.E in Electrical and Electronics",
school: "Sri Krishna College of Engineering and Technology",
dates: "2011 β 2015",
details: [
"Graduated with First Class Honours"
]
}
]
};
// Formatting helpers
function formatBoldText(text, useColors = true) {
if (!useColors) {
return text.replace(/\*\*(.*?)\*\*/g, '$1');
}
return text.replace(/\*\*(.*?)\*\*/g, (match, p1) => {
return chalk.bold(p1);
});
}
// Output formatters
function formatColoredResume(sections = null) {
const data = resumeData;
const selectedSections = sections || ['personal', 'profile', 'techStack', 'experience', 'projects', 'leadership', 'openSource', 'education'];
let output = '';
if (selectedSections.includes('personal')) {
const title = chalk.bold.hex("#ff6b6b")(data.personal.name);
const role = chalk.bold(data.personal.role);
const location = chalk.green(data.personal.location);
const email = chalk.cyan(data.personal.email);
const phone = chalk.yellow(data.personal.phone);
const linkedin = chalk.blue(data.personal.linkedin);
const github = chalk.blue(data.personal.github);
const portfolio = chalk.underline(data.personal.portfolio);
output += `${title}\n${role} ${chalk.white("β’")} ${location}\n\n`;
output += `${chalk.bold("Contact")}\n${email} β’ ${phone}\n${linkedin}\n${github}\n${portfolio}\n\n`;
}
if (selectedSections.includes('techStack')) {
const techStackStr = data.techStack.join(" β’ ");
const boxedTech = boxen(chalk.yellowBright(techStackStr), {
padding: 1,
margin: 1,
borderStyle: "round",
textAlignment: "center"
});
output += `${boxedTech}\n\n`;
}
if (selectedSections.includes('profile')) {
output += `${chalk.cyanBright.bold("Profile")}\n${chalk.white(data.profile)}\n\n`;
}
if (selectedSections.includes('experience')) {
output += `${chalk.greenBright.bold("Experience")}\n`;
data.experience.forEach(job => {
const bullets = job.bullets.map(bullet => ` β’ ${formatBoldText(bullet)}`).join('\n');
output += `\n ${chalk.bold(job.company)} β ${job.title} (${job.dates})\n${bullets}\n`;
});
output += '\n';
}
if (selectedSections.includes('projects')) {
output += `${chalk.magentaBright.bold("Key Projects")}\n`;
data.projects.forEach(project => {
output += `\n ${chalk.bold(project.name)}\n ${project.desc}\n ${chalk.dim(project.tech)}\n`;
});
output += '\n';
}
if (selectedSections.includes('leadership')) {
output += `${chalk.blueBright.bold("Leadership & Mentoring")}\n`;
data.leadership.forEach(item => {
output += ` β’ ${item}\n`;
});
output += '\n';
}
if (selectedSections.includes('openSource')) {
output += `${chalk.cyanBright.bold("Open-source & Community")}\n`;
data.openSource.forEach(item => {
output += ` β’ ${item}\n`;
});
output += '\n';
}
if (selectedSections.includes('education')) {
output += `${chalk.whiteBright.bold("Education")}\n`;
data.education.forEach(edu => {
const details = edu.details.map(detail => ` β’ ${detail}`).join('\n');
output += `\n ${chalk.bold(edu.degree)}\n ${edu.school} (${edu.dates})\n${details}\n`;
});
output += '\n';
}
output += `${chalk.dim("Run 'npx bharathkumar-palanisamy' to print this resume.")}\n`;
return output.trim();
}
function formatPlainResume(sections = null) {
const data = resumeData;
const selectedSections = sections || ['personal', 'profile', 'techStack', 'experience', 'projects', 'leadership', 'openSource', 'education'];
let output = '';
if (selectedSections.includes('personal')) {
output += `${data.personal.name}\n${data.personal.role} β’ ${data.personal.location}\n\n`;
output += `Contact\n${data.personal.email} β’ ${data.personal.phone}\n${data.personal.linkedin}\n${data.personal.github}\n${data.personal.portfolio}\n\n`;
}
if (selectedSections.includes('techStack')) {
const techStackStr = data.techStack.join(" β’ ");
output += `Tech Stack\n${techStackStr}\n\n`;
}
if (selectedSections.includes('profile')) {
output += `Profile\n${data.profile}\n\n`;
}
if (selectedSections.includes('experience')) {
output += `Experience\n`;
data.experience.forEach(job => {
const bullets = job.bullets.map(bullet => ` β’ ${formatBoldText(bullet, false)}`).join('\n');
output += `\n ${job.company} β ${job.title} (${job.dates})\n${bullets}\n`;
});
output += '\n';
}
if (selectedSections.includes('projects')) {
output += `Key Projects\n`;
data.projects.forEach(project => {
output += `\n ${project.name}\n ${project.desc}\n ${project.tech}\n`;
});
output += '\n';
}
if (selectedSections.includes('leadership')) {
output += `Leadership & Mentoring\n`;
data.leadership.forEach(item => {
output += ` β’ ${item}\n`;
});
output += '\n';
}
if (selectedSections.includes('openSource')) {
output += `Open-source & Community\n`;
data.openSource.forEach(item => {
output += ` β’ ${item}\n`;
});
output += '\n';
}
if (selectedSections.includes('education')) {
output += `Education\n`;
data.education.forEach(edu => {
const details = edu.details.map(detail => ` β’ ${detail}`).join('\n');
output += `\n ${edu.degree}\n ${edu.school} (${edu.dates})\n${details}\n`;
});
output += '\n';
}
output += `Run 'npx bharathkumar-palanisamy' to print this resume.\n`;
return output.trim();
}
function formatJsonResume(sections = null) {
const data = { ...resumeData };
if (sections && sections.length > 0) {
const filteredData = {};
sections.forEach(section => {
if (data[section]) {
filteredData[section] = data[section];
}
});
return JSON.stringify(filteredData, null, 2);
}
return JSON.stringify(data, null, 2);
}
function formatHtmlResume(sections = null) {
const data = resumeData;
const selectedSections = sections || ['personal', 'profile', 'techStack', 'experience', 'projects', 'leadership', 'openSource', 'education'];
let htmlContent = '';
if (selectedSections.includes('personal')) {
htmlContent += `
<header class="header">
<h1 class="name">${data.personal.name}</h1>
<p class="role">${data.personal.role}</p>
<p class="location">${data.personal.location}</p>
<div class="contact">
<a href="mailto:${data.personal.email}">${data.personal.email}</a>
<span>${data.personal.phone}</span>
<a href="${data.personal.linkedin}" target="_blank">LinkedIn</a>
<a href="${data.personal.github}" target="_blank">GitHub</a>
<a href="${data.personal.portfolio}" target="_blank">Portfolio</a>
</div>
</header>`;
}
if (selectedSections.includes('profile')) {
htmlContent += `
<section class="section">
<h2>Profile</h2>
<p class="profile-text">${data.profile}</p>
</section>`;
}
if (selectedSections.includes('techStack')) {
htmlContent += `
<section class="section">
<h2>Tech Stack</h2>
<div class="tech-stack">
${data.techStack.map(tech => `<span class="tech-item">${tech}</span>`).join('')}
</div>
</section>`;
}
if (selectedSections.includes('experience')) {
htmlContent += `
<section class="section">
<h2>Experience</h2>
${data.experience.map(exp => `
<div class="experience-item">
<div class="experience-header">
<h3>${exp.company}</h3>
<span class="dates">${exp.dates}</span>
</div>
<p class="job-title">${exp.title}</p>
<ul class="bullets">
${exp.bullets.map(bullet => `<li>${bullet.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')}</li>`).join('')}
</ul>
</div>
`).join('')}
</section>`;
}
if (selectedSections.includes('projects')) {
htmlContent += `
<section class="section">
<h2>Key Projects</h2>
${data.projects.map(project => `
<div class="project-item">
<h3>${project.name}</h3>
<p class="project-desc">${project.desc}</p>
<p class="project-tech">${project.tech}</p>
</div>
`).join('')}
</section>`;
}
if (selectedSections.includes('leadership')) {
htmlContent += `
<section class="section">
<h2>Leadership & Mentoring</h2>
<ul class="simple-list">
${data.leadership.map(item => `<li>${item}</li>`).join('')}
</ul>
</section>`;
}
if (selectedSections.includes('openSource')) {
htmlContent += `
<section class="section">
<h2>Open-source & Community</h2>
<ul class="simple-list">
${data.openSource.map(item => `<li>${item}</li>`).join('')}
</ul>
</section>`;
}
if (selectedSections.includes('education')) {
htmlContent += `
<section class="section">
<h2>Education</h2>
${data.education.map(edu => `
<div class="education-item">
<h3>${edu.degree}</h3>
<p class="school">${edu.school} (${edu.dates})</p>
<ul class="simple-list">
${edu.details.map(detail => `<li>${detail}</li>`).join('')}
</ul>
</div>
`).join('')}
</section>`;
}
return `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>${data.personal.name} - Resume</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 1.6;
color: #333;
max-width: 800px;
margin: 0 auto;
padding: 40px 20px;
background: #fff;
}
.header {
text-align: center;
margin-bottom: 40px;
padding-bottom: 30px;
border-bottom: 2px solid #e0e0e0;
}
.name {
font-size: 2.5rem;
font-weight: 700;
color: #2c3e50;
margin-bottom: 10px;
}
.role {
font-size: 1.3rem;
color: #3498db;
margin-bottom: 5px;
font-weight: 500;
}
.location {
color: #7f8c8d;
margin-bottom: 20px;
}
.contact {
display: flex;
justify-content: center;
gap: 20px;
flex-wrap: wrap;
}
.contact a, .contact span {
color: #3498db;
text-decoration: none;
padding: 5px 10px;
border-radius: 5px;
background: #ecf0f1;
transition: background 0.3s;
}
.contact a:hover {
background: #3498db;
color: white;
}
.section {
margin-bottom: 35px;
}
.section h2 {
font-size: 1.5rem;
color: #2c3e50;
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 1px solid #bdc3c7;
}
.profile-text {
font-size: 1.1rem;
line-height: 1.7;
color: #555;
}
.tech-stack {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.tech-item {
background: #3498db;
color: white;
padding: 8px 15px;
border-radius: 20px;
font-size: 0.9rem;
font-weight: 500;
}
.experience-item, .project-item, .education-item {
margin-bottom: 25px;
padding: 20px;
background: #f8f9fa;
border-radius: 8px;
border-left: 4px solid #3498db;
}
.experience-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 5px;
}
.experience-header h3 {
color: #2c3e50;
font-size: 1.2rem;
}
.dates {
color: #7f8c8d;
font-weight: 500;
}
.job-title {
color: #3498db;
font-weight: 600;
margin-bottom: 15px;
}
.bullets, .simple-list {
list-style: none;
padding-left: 0;
}
.bullets li, .simple-list li {
margin-bottom: 8px;
padding-left: 20px;
position: relative;
}
.bullets li:before {
content: 'βΈ';
color: #3498db;
position: absolute;
left: 0;
}
.simple-list li:before {
content: 'β’';
color: #3498db;
position: absolute;
left: 0;
}
.project-item h3, .education-item h3 {
color: #2c3e50;
margin-bottom: 10px;
}
.project-desc {
margin-bottom: 10px;
line-height: 1.6;
}
.project-tech {
color: #7f8c8d;
font-style: italic;
}
.school {
color: #3498db;
font-weight: 500;
margin-bottom: 10px;
}
@media (max-width: 600px) {
.contact {
flex-direction: column;
align-items: center;
}
.experience-header {
flex-direction: column;
align-items: flex-start;
}
.name {
font-size: 2rem;
}
}
@media print {
body {
padding: 20px;
}
.contact a {
color: #333 !important;
}
}
</style>
</head>
<body>
${htmlContent}
</body>
</html>`;
}
async function formatPdfResume(sections = null) {
const htmlContent = formatHtmlResume(sections);
try {
const browser = await puppeteer.launch({
headless: 'new',
args: ['--no-sandbox', '--disable-setuid-sandbox']
});
const page = await browser.newPage();
await page.setContent(htmlContent, { waitUntil: 'networkidle0' });
const pdfBuffer = await page.pdf({
format: 'A4',
printBackground: true,
margin: {
top: '20mm',
right: '15mm',
bottom: '20mm',
left: '15mm'
}
});
await browser.close();
return pdfBuffer;
} catch (error) {
throw new Error(`PDF generation failed: ${error.message}`);
}
}
// Command line interface
const program = new Command();
program
.name('bharathkumar-palanisamy')
.description('CLI resume for Bharathkumar Palanisamy - Full-Stack Engineer')
.version(packageJson.version);
program
.option('-f, --format <type>', 'output format (colored, plain, json, html, pdf)', 'colored')
.option('-s, --section <sections...>', 'specific sections to display (personal, profile, techStack, experience, projects, leadership, openSource, education)')
.option('-o, --output <file>', 'save resume to file')
.option('-i, --interactive', 'enable interactive navigation mode')
.action(async (options) => {
// Handle interactive mode
if (options.interactive) {
await runInteractiveMode();
return;
}
let output;
let isBuffer = false;
const sections = options.section;
// Validate sections if provided
if (sections) {
const validSections = ['personal', 'profile', 'techStack', 'experience', 'projects', 'leadership', 'openSource', 'education'];
const invalidSections = sections.filter(s => !validSections.includes(s));
if (invalidSections.length > 0) {
console.error(`Invalid sections: ${invalidSections.join(', ')}`);
console.error(`Valid sections: ${validSections.join(', ')}`);
process.exit(1);
}
}
// Generate output based on format
switch (options.format) {
case 'json':
output = formatJsonResume(sections);
break;
case 'plain':
output = formatPlainResume(sections);
break;
case 'html':
output = formatHtmlResume(sections);
break;
case 'pdf':
try {
output = await formatPdfResume(sections);
isBuffer = true;
} catch (error) {
console.error(`Error generating PDF: ${error.message}`);
process.exit(1);
}
break;
case 'colored':
default:
output = formatColoredResume(sections);
break;
}
// Output to file or console
if (options.output) {
try {
if (isBuffer) {
fs.writeFileSync(options.output, output);
} else {
fs.writeFileSync(options.output, output, 'utf8');
}
console.log(`Resume saved to ${options.output}`);
} catch (error) {
console.error(`Error writing to file: ${error.message}`);
process.exit(1);
}
} else {
if (isBuffer) {
console.log('PDF format requires an output file. Use -o option to specify output file.');
} else {
console.log(output);
}
}
});
// Interactive mode function
async function runInteractiveMode() {
console.log(chalk.cyanBright.bold('\nπ Interactive Resume Navigator\n'));
while (true) {
const { action } = await inquirer.prompt([
{
type: 'list',
name: 'action',
message: 'What would you like to do?',
choices: [
{ name: 'π View Resume Sections', value: 'sections' },
{ name: 'π± Generate QR Codes', value: 'qr' },
{ name: 'π Copy Contact Info', value: 'clipboard' },
{ name: 'πΎ Export Resume', value: 'export' },
{ name: 'β Exit', value: 'exit' }
]
}
]);
switch (action) {
case 'sections':
await navigateSections();
break;
case 'qr':
await generateQRCodes();
break;
case 'clipboard':
await copyToClipboard();
break;
case 'export':
await exportResume();
break;
case 'exit':
console.log(chalk.greenBright('\nπ Thanks for using the interactive resume!\n'));
return;
}
}
}
// Navigate through resume sections
async function navigateSections() {
const sectionChoices = [
{ name: 'π€ Personal Info', value: 'personal' },
{ name: 'π Profile', value: 'profile' },
{ name: 'β‘ Tech Stack', value: 'techStack' },
{ name: 'πΌ Experience', value: 'experience' },
{ name: 'π Projects', value: 'projects' },
{ name: 'π₯ Leadership', value: 'leadership' },
{ name: 'π Open Source', value: 'openSource' },
{ name: 'π Education', value: 'education' },
{ name: 'π Full Resume', value: 'full' },
{ name: 'β¬
οΈ Back to Main Menu', value: 'back' }
];
while (true) {
const { section } = await inquirer.prompt([
{
type: 'list',
name: 'section',
message: 'Which section would you like to view?',
choices: sectionChoices
}
]);
if (section === 'back') break;
console.log('\n' + '='.repeat(50));
if (section === 'full') {
console.log(formatColoredResume());
} else {
console.log(formatColoredResume([section]));
}
console.log('='.repeat(50) + '\n');
// Ask if user wants to continue viewing sections
const { continueViewing } = await inquirer.prompt([
{
type: 'confirm',
name: 'continueViewing',
message: 'Would you like to view another section?',
default: true
}
]);
if (!continueViewing) break;
}
}
// Generate QR codes for contact information
async function generateQRCodes() {
const qrChoices = [
{ name: 'π§ Email', value: 'email' },
{ name: 'π± Phone', value: 'phone' },
{ name: 'πΌ LinkedIn', value: 'linkedin' },
{ name: 'π GitHub', value: 'github' },
{ name: 'π Portfolio', value: 'portfolio' },
{ name: 'β¬
οΈ Back to Main Menu', value: 'back' }
];
while (true) {
const { contact } = await inquirer.prompt([
{
type: 'list',
name: 'contact',
message: 'Generate QR code for which contact method?',
choices: qrChoices
}
]);
if (contact === 'back') break;
let contactData = '';
let contactLabel = '';
switch (contact) {
case 'email':
contactData = `mailto:${resumeData.personal.email.replace('π§ ', '')}`;
contactLabel = 'Email';
break;
case 'phone':
contactData = `tel:${resumeData.personal.phone.replace('π± ', '')}`;
contactLabel = 'Phone';
break;
case 'linkedin':
contactData = resumeData.personal.linkedin.replace('π ', '');
contactLabel = 'LinkedIn';
break;
case 'github':
contactData = resumeData.personal.github.replace('π ', '');
contactLabel = 'GitHub';
break;
case 'portfolio':
contactData = resumeData.personal.portfolio.replace('π ', '');
contactLabel = 'Portfolio';
break;
}
try {
console.log(`\n${chalk.cyanBright.bold(`QR Code for ${contactLabel}:`)}`);
console.log(chalk.dim(`Data: ${contactData}\n`));
const qrString = await qrcode.toString(contactData, {
type: 'terminal',
small: true
});
console.log(qrString);
console.log(chalk.yellowBright('π± Scan with your phone to access this contact info!\n'));
} catch (error) {
console.error(chalk.red(`Error generating QR code: ${error.message}`));
}
// Ask if user wants to generate another QR code
const { continueQR } = await inquirer.prompt([
{
type: 'confirm',
name: 'continueQR',
message: 'Would you like to generate another QR code?',
default: true
}
]);
if (!continueQR) break;
}
}
// Copy contact information to clipboard
async function copyToClipboard() {
const clipboardChoices = [
{ name: 'π§ Email Address', value: 'email' },
{ name: 'π± Phone Number', value: 'phone' },
{ name: 'πΌ LinkedIn URL', value: 'linkedin' },
{ name: 'π GitHub URL', value: 'github' },
{ name: 'π Portfolio URL', value: 'portfolio' },
{ name: 'π All Contact Info', value: 'all' },
{ name: 'β¬
οΈ Back to Main Menu', value: 'back' }
];
while (true) {
const { contact } = await inquirer.prompt([
{
type: 'list',
name: 'contact',
message: 'What would you like to copy to clipboard?',
choices: clipboardChoices
}
]);
if (contact === 'back') break;
let clipboardData = '';
let contactLabel = '';
switch (contact) {
case 'email':
clipboardData = resumeData.personal.email.replace('π§ ', '');
contactLabel = 'Email address';
break;
case 'phone':
clipboardData = resumeData.personal.phone.replace('π± ', '');
contactLabel = 'Phone number';
break;
case 'linkedin':
clipboardData = resumeData.personal.linkedin.replace('π ', '');
contactLabel = 'LinkedIn URL';
break;
case 'github':
clipboardData = resumeData.personal.github.replace('π ', '');
contactLabel = 'GitHub URL';
break;
case 'portfolio':
clipboardData = resumeData.personal.portfolio.replace('π ', '');
contactLabel = 'Portfolio URL';
break;
case 'all':
clipboardData = `Email: ${resumeData.personal.email.replace('π§ ', '')}\nPhone: ${resumeData.personal.phone.replace('π± ', '')}\nLinkedIn: ${resumeData.personal.linkedin.replace('π ', '')}\nGitHub: ${resumeData.personal.github.replace('π ', '')}\nPortfolio: ${resumeData.personal.portfolio.replace('π ', '')}`;
contactLabel = 'All contact information';
break;
}
try {
await clipboardy.write(clipboardData);
console.log(chalk.greenBright(`\nβ
${contactLabel} copied to clipboard!`));
console.log(chalk.dim(`Copied: ${clipboardData.split('\n')[0]}${clipboardData.includes('\n') ? '...' : ''}\n`));
} catch (error) {
console.error(chalk.red(`Error copying to clipboard: ${error.message}`));
}
// Ask if user wants to copy something else
const { continueCopy } = await inquirer.prompt([
{
type: 'confirm',
name: 'continueCopy',
message: 'Would you like to copy something else?',
default: true
}
]);
if (!continueCopy) break;
}
}
// Export resume in different formats
async function exportResume() {
const { format } = await inquirer.prompt([
{
type: 'list',
name: 'format',
message: 'Which format would you like to export?',
choices: [
{ name: 'π¨ Colored (Terminal)', value: 'colored' },
{ name: 'π Plain Text', value: 'plain' },
{ name: 'π JSON', value: 'json' },
{ name: 'π HTML (Web)', value: 'html' },
{ name: 'π PDF (Print)', value: 'pdf' }
]
}
]);
const { filename } = await inquirer.prompt([
{
type: 'input',
name: 'filename',
message: 'Enter filename (without extension):',
default: 'bharathkumar-resume'
}
]);
const extensions = { colored: 'txt', plain: 'txt', json: 'json', html: 'html', pdf: 'pdf' };
const fullFilename = `${filename}.${extensions[format]}`;