Skip to content

Commit c933c11

Browse files
committed
📦NEW: executable CLI
1 parent 8ae92d5 commit c933c11

1 file changed

Lines changed: 3 additions & 32 deletions

File tree

index.js

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,10 @@
1-
/*
1+
/**
22
*
33
* Author: Muhammad Saad
44
* GitHub: msaaddev
55
* Twitter: https://twitter.com/msaaddev
66
*/
77

8-
const io = require("console-read-write");
9-
const { cyan } = require("chalk");
10-
const box = require("./utils/box");
11-
const axios = require("axios");
8+
const cli = require("./utils/cli");
129

13-
module.exports = async () => {
14-
console.log("------------------------------------------");
15-
// getting data from terminal
16-
io.write(cyan("> Enter GitHub username"));
17-
const URL = await io.read();
18-
await axios
19-
.get(`https://api.github.com/users/${URL}/events/public`)
20-
.then((res) => {
21-
for (let i = 0; i < res.data.length; i++) {
22-
if (res.data[i].type === "PushEvent") {
23-
const name = "✉️ Email";
24-
box(name, res.data[i].payload.commits[0].author.email);
25-
break;
26-
}
27-
if (i === res.data.length - 1) {
28-
const name = "⚠️ WARNING";
29-
const msg = "No Email Found!!";
30-
box(name, msg);
31-
}
32-
}
33-
})
34-
.catch((err) => {
35-
const name = "⚠️ WARNING";
36-
const msg = "Cannot Access Email!!";
37-
box(name, msg);
38-
});
39-
};
10+
cli();

0 commit comments

Comments
 (0)