File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /**
2+ *
3+ * Author: Muhammad Saad
4+ * GitHub: msaaddev
5+ * Twitter: https://twitter.com/msaaddev
6+ */
7+
8+ const io = require ( "console-read-write" ) ;
9+ const { cyan } = require ( "chalk" ) ;
10+ const box = require ( "./box" ) ;
11+ const axios = require ( "axios" ) ;
12+ const headers = require ( "./auth" ) ;
13+
14+ module . exports = async ( ) => {
15+ console . log ( "------------------------------------------" ) ;
16+ // getting data from terminal
17+ io . write ( cyan ( "> Enter GitHub Username" ) ) ;
18+ const username = await io . read ( ) ;
19+ console . log ( "" ) ;
20+ io . write ( cyan ( "> Enter GitHub Repo Name" ) ) ;
21+ const repo = await io . read ( ) ;
22+
23+
24+ await axios
25+ . get (
26+ `https://api.github.com/repos/${ username } /${ repo } ?access_token=${ headers . Authorization } ` ,
27+ {
28+ headers : headers ,
29+ }
30+ )
31+ . then ( ( res ) => {
32+ const name = "⭐️ Stars" ;
33+ const data = res . data . stargazers_count ;
34+ box ( name , data ) ;
35+ } )
36+ . catch ( ( err ) => {
37+ const name = "⚠️ WARNING" ;
38+ const msg = "Cannot Access Stars!!" ;
39+ box ( name , msg ) ;
40+ } ) ;
41+ } ;
You can’t perform that action at this time.
0 commit comments