FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
stack-analyze/cli.js at master · stack-analyze/stack-analyze · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
stack-analyze
/
stack-analyze
Public
Notifications
You must be signed in to change notification settings
Fork
1
Star
3
Code
Issues
0
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
stack-analyze
/
cli.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
224 lines (186 loc) · 5.08 KB
Breadcrumbs
stack-analyze
/
cli.js
Copy path
File metadata and controls
224 lines (186 loc) · 5.08 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#!/usr/bin/env node
const
ora
=
require
(
"ora"
)
.
default
;
const
{
yellow
,
bgRed
}
=
require
(
"colors"
)
;
const
{
confirm
,
input
}
=
require
(
"@inquirer/prompts"
)
;
const
{
textSync
}
=
require
(
"figlet"
)
;
const
{
stackMenu
}
=
require
(
"./menu.js"
)
;
const
{
menuWebOpts
,
webTools
}
=
require
(
"./hash/webTools.js"
)
;
const
{
menuQueryOpts
,
queryTools
}
=
require
(
"./hash/queryTools.js"
)
;
const
{
infoTools
,
menuInfoOpts
}
=
require
(
"./hash/infoTools.js"
)
;
const
{
menuUtilityOpts
,
utilityTools
}
=
require
(
"./hash/utilityTools.js"
)
;
const
{
menuWallpaperOpts
,
wallpaperSelect
}
=
require
(
"./hash/wallpaperSelect.js"
)
;
const
{
aboutTool
,
menuAboutOpts
}
=
require
(
"./about.js"
)
;
const
{
exitMsg
}
=
require
(
"./utils.js"
)
;
const
{
quoteSelect
,
menuQuoteOpts
}
=
require
(
"./hash/quotesSelect.js"
)
;
const
getStations
=
require
(
"./functions/getStations.js"
)
;
const
[
spinner
,
totalTime
,
pageSize
]
=
[
ora
(
{
spinner
:
"dots11"
,
color
:
"white"
}
)
,
1e4
,
9
]
;
/**
@returns
{
void
} */
const
exitCli
=
(
)
=>
{
console
.
clear
(
)
;
console
.
info
(
exitMsg
)
;
}
;
/**
@returns
{
Promise<void>
} */
async
function
webOpts
(
)
{
console
.
info
(
yellow
(
textSync
(
"web options"
)
)
)
;
const
web
=
await
stackMenu
(
{
pageSize
,
message
:
"enter a web tool option"
,
choices
:
menuWebOpts
}
)
;
web
!==
"return main menu"
?
webTools
[
web
]
(
returnMain
)
:
mainMenu
(
)
;
}
/**
@returns
{
Promise<void>
} */
async
function
infoOpts
(
)
{
console
.
info
(
yellow
(
textSync
(
"info options"
)
)
)
;
const
info
=
await
stackMenu
(
{
pageSize
,
message
:
"enter a info tool option"
,
choices
:
menuInfoOpts
}
)
;
info
===
"return main menu"
?
mainMenu
(
)
:
infoTools
[
info
]
(
returnMain
)
;
}
/**
@returns
{
Promise<void>
} */
async
function
queryOpts
(
)
{
console
.
info
(
yellow
(
textSync
(
"query options"
)
)
)
;
const
query
=
await
stackMenu
(
{
pageSize
,
message
:
"enter a query tool option"
,
choices
:
menuQueryOpts
}
)
;
query
===
"return main menu"
?
mainMenu
(
)
:
queryTools
[
query
]
(
returnMain
)
;
}
/**
@returns
{
Promise<void>
} */
async
function
wallpapersOpts
(
)
{
console
.
info
(
yellow
(
textSync
(
"wallpapers"
)
)
)
;
const
wallpaper
=
await
stackMenu
(
{
pageSize
,
message
:
"enter a wallpaper selector"
,
choices
:
menuWallpaperOpts
}
)
;
wallpaper
===
"return main menu"
?
mainMenu
(
)
:
wallpaperSelect
[
wallpaper
]
(
returnMain
,
wallpapersOpts
)
;
}
/**
@returns
{
Promise<void>
} */
async
function
quotesOpts
(
)
{
console
.
info
(
yellow
(
textSync
(
"quotes"
)
)
)
;
const
quotes
=
await
stackMenu
(
{
pageSize
,
choices
:
menuQuoteOpts
,
message
:
"enter a quote option"
}
)
;
quotes
===
"return main menu"
?
mainMenu
(
)
:
quoteSelect
[
quotes
]
(
returnMain
)
;
}
/**
@returns
{
Promise<void>
} */
async
function
utilityOpts
(
)
{
console
.
info
(
yellow
(
textSync
(
"utility options"
)
)
)
;
const
utility
=
await
stackMenu
(
{
pageSize
,
message
:
"enter a utility tool option"
,
choices
:
menuUtilityOpts
}
)
;
utility
===
"return main menu"
?
mainMenu
(
)
:
utilityTools
[
utility
]
(
returnMain
)
;
}
/**
@returns
{
Promise<void>
} */
async
function
aboutOpts
(
)
{
console
.
info
(
yellow
(
textSync
(
"About Menu"
)
)
)
;
const
about
=
await
stackMenu
(
{
pageSize
,
message
:
"select about option info"
,
choices
:
menuAboutOpts
}
)
;
about
!==
"return main menu"
?
aboutTool
[
about
]
(
aboutOpts
)
:
mainMenu
(
)
;
}
/**
@returns
{
Promise<void>
} */
async
function
mainMenu
(
)
{
console
.
clear
(
)
;
console
.
info
(
yellow
(
textSync
(
"stack-analyze"
)
)
)
;
const
menuList
=
{
web
(
)
{
console
.
clear
(
)
;
webOpts
(
)
;
}
,
info
(
)
{
console
.
clear
(
)
;
infoOpts
(
)
;
}
,
query
(
)
{
console
.
clear
(
)
;
queryOpts
(
)
;
}
,
utility
(
)
{
console
.
clear
(
)
;
utilityOpts
(
)
;
}
,
wallpapers
(
)
{
console
.
clear
(
)
;
wallpapersOpts
(
)
;
}
,
quotes
(
)
{
console
.
clear
(
)
;
quotesOpts
(
)
;
}
,
async
stations
(
)
{
console
.
warn
(
"some stations not visble only info"
.
yellow
)
;
const
country
=
await
input
(
{
message
:
"enter a country for search:"
}
)
;
getStations
(
country
)
;
setTimeout
(
returnMain
,
5e3
)
;
}
,
about
(
)
{
console
.
clear
(
)
;
aboutOpts
(
)
;
}
}
;
const
option
=
await
stackMenu
(
{
message
:
"what option do you want to analyze stack:"
,
choices
:
[
...
Object
.
keys
(
menuList
)
,
"exit"
]
,
pageSize
:
10
}
)
;
option
!==
"exit"
?
menuList
[
option
]
(
)
:
exitCli
(
)
;
}
/**
@returns
{
Promise<void>
} */
async
function
returnMain
(
)
{
try
{
const
returnMain
=
await
confirm
(
{
message
:
"do you want go to the main menu?"
,
}
)
.
catch
(
)
;
returnMain
?
mainMenu
(
)
:
exitCli
(
)
;
}
catch
(
err
)
{
console
.
error
(
bgRed
(
(
/**
@type
{
Error
} */
(
err
)
)
.
message
)
)
;
}
}
process
.
on
(
"uncaughtException"
,
(
err
)
=>
{
if
(
err
instanceof
Error
&&
err
.
name
===
"ExitPromptError"
)
{
console
.
info
(
"👋 ohh sorry:"
.
yellow
,
exitMsg
)
;
}
else
{
throw
err
;
}
}
)
;
for
(
let
i
=
50
;
i
<
totalTime
;
i
+=
50
)
{
const
percentage
=
i
/
totalTime
*
100
;
setTimeout
(
(
)
=>
{
spinner
.
text
=
`Loading app...
${
Math
.
ceil
(
percentage
)
}
%`
.
random
;
spinner
.
start
(
)
;
}
,
i
)
;
}
setTimeout
(
(
)
=>
{
spinner
.
stop
(
)
;
mainMenu
(
)
;
}
,
totalTime
)
;
Back
|
FazBrowse Home
|
New Git URL