@@ -12,6 +12,7 @@ import org.example.JargonLevel
1212import org.example.info
1313import org.example.warn
1414import kotlin.math.min
15+ import kotlin.random.Random
1516
1617// TODO: Put better names, just added this to make code a bit clearer
1718data class Process (val text : String , val suffix : String? )
@@ -31,7 +32,8 @@ abstract class DataSource(
3132 val tasks: List < suspend () -> Unit > = listOf (
3233 {codeAnalysis()},
3334 {monitorSystemResources()},
34- {analyzeAPIEndpoints()},
35+ {analyzeData()},
36+ {analyzeAPI()}
3537 )
3638
3739 abstract val envType: String
@@ -46,7 +48,7 @@ abstract class DataSource(
4648
4749 terminal.info(
4850 """
49- ${(TextColors .brightYellow + TextStyles .bold)(" 🖥️ - Initializing Development Environment" )}
51+ ${(TextColors .brightYellow + TextStyles .bold)(" \uD83D\uDDA5\uFE0F - Initializing Development Environment" )}
5052 - Project: ${terminal.theme.success(projectName)}
5153 - Environment: ${terminal.theme.success(envName ? : envType)}
5254
@@ -73,7 +75,7 @@ abstract class DataSource(
7375 }
7476
7577 job.join()
76- println (" " )
78+ terminal. println (" " )
7779 }
7880
7981 abstract val classNamePrefix: List <String >
@@ -85,7 +87,7 @@ abstract class DataSource(
8587 get() = " ${classNamePrefix.random()}${classNameSuffix.random()} .${fileExtension.random()} "
8688
8789 suspend fun codeAnalysis () = coroutineScope {
88- terminal.info((TextColors .cyan + TextStyles .bold)(" 🔎 - Running Code Analysis on API Components" ))
90+ terminal.info((TextColors .cyan + TextStyles .bold)(" \uD83D\uDD0E - Running Code Analysis on API Components" ))
8991
9092 val total = (5 .. 26 ).random()
9193 val progress = progressBarLayout {
@@ -104,7 +106,11 @@ abstract class DataSource(
104106 val num = a.range.random()
105107 val (label, isGood) = a.labelFn(num)
106108
107- terminal.println (" ${if (isGood) " ✅" else " ⚠️" } - $fileName - ${a.name} : $num${a.suffix} ($label )" )
109+ " ${if (isGood) " ✅" else " ⚠️" } - $fileName - ${a.name} : $num${a.suffix} ($label )" .also {
110+ if (isGood) terminal.info(it)
111+ else terminal.warn(it)
112+ }
113+
108114 delay((10 .. 700 ).random().toLong())
109115 progress.advance(1 )
110116 }
@@ -115,14 +121,14 @@ abstract class DataSource(
115121 fetchJargon()?.also { results.add(it) }
116122
117123 job.join()
118- println (" " )
119- terminal.info(TextColors .cyan(" 📊 - Analysis Results: $total files, ${total * (200 .. 2000 ).random()} lines of code" ))
124+ terminal. println (" " )
125+ terminal.info(TextColors .cyan(" \uD83D\uDCCA - Analysis Results: $total files, ${total * (200 .. 2000 ).random()} lines of code" ))
120126 for (r in results) println (" - $r " )
121- println (" " )
127+ terminal. println (" " )
122128 }
123129
124130 suspend fun monitorSystemResources () = coroutineScope {
125- terminal.info((TextColors .brightMagenta + TextStyles .bold)(" 💽️ - Monitoring System Resources" ))
131+ terminal.info((TextColors .brightMagenta + TextStyles .bold)(" \uD83D\uDCBD - Monitoring System Resources" ))
126132
127133 val progress = progressBarLayout {
128134 spinner(Spinner .Dots ())
@@ -151,19 +157,19 @@ abstract class DataSource(
151157 }
152158
153159 job.join()
154- println (" " )
160+ terminal. println (" " )
155161
156162 terminal.info(
157163 """
158- ${TextColors .cyan(" 📊 - Resource Utilization:" )}
164+ ${TextColors .cyan(" \uD83D\uDCCA - Resource Utilization:" )}
159165 - Peak CPU: ${(0 .. 100 ).random()} %
160166 - Peak Memory: ${(0 .. 100 ).random()} %
161167 - Average Network Speed: ${(0 .. 200 ).random()} MB/s
162168 - Average Disk Write Speed: ${(0 .. 600 ).random()} MB/s
163169 """ .trimIndent()
164170 )
165171
166- println (" " )
172+ terminal. println (" " )
167173 }
168174
169175 val statusCodes: List <Int > = listOf (
@@ -174,8 +180,8 @@ abstract class DataSource(
174180 )
175181
176182 abstract val apiEndpoints: List <String >
177- suspend fun analyzeAPIEndpoints () = coroutineScope{
178- terminal.info((TextColors .brightCyan + TextStyles .bold)(" 🕸️ - Analyzing API Traffic " ))
183+ suspend fun analyzeAPI () = coroutineScope {
184+ terminal.info((TextColors .brightCyan + TextStyles .bold)(" 🕸️ - Analyzing API Endpoints " ))
179185
180186 val itr = apiEndpoints.shuffled().iterator()
181187 val maxPadding = apiEndpoints.max().length
@@ -222,18 +228,89 @@ abstract class DataSource(
222228 }
223229
224230 job.join()
225- println (" " )
231+ terminal. println (" " )
226232 terminal.info(
227233 """
228- ${TextColors .cyan(" 📊 - Network Activity Summary:" )}
234+ ${TextColors .cyan(" \uD83D\uDCCA - Network Activity Summary:" )}
229235 - Total requests: ${(0 .. 1000 ).random()}
230236 - Average response time: ${(0 .. 100 ).random()} ms
231237 - Success rate: ${(0 .. 100 ).random()} %
232238 - Bandwidth utilization: ${(20 .. 200 ).random()} MB/s
233239 """ .trimIndent()
234240 )
235241
236- println (" " )
242+ terminal. println (" " )
237243 }
238244
245+ open val processingJargonPrefix: List <String > = listOf (
246+ " Compressing" ,
247+ " Migrating" ,
248+ " Generating" ,
249+ " Optimizing" ,
250+ " Evaluating caches for" ,
251+ " Processing" ,
252+ " Executing" ,
253+ " Evaluating" ,
254+ " Applying"
255+ )
256+
257+ open val processingJargonSuffix: List <String > = listOf (
258+ " reports" ,
259+ " indexes" ,
260+ " transactions" ,
261+ " replicas" ,
262+ )
263+
264+ open val processingJargonSizes: List <String > = listOf (" KB" , " MB" , " GB" , " B" )
265+
266+ abstract val processJargon: List <String >
267+ abstract val processSubJargon: List <String >
268+
269+ suspend fun analyzeData () = coroutineScope {
270+ terminal.info((TextColors .brightCyan + TextStyles .bold)(" \uD83D\uDD03 ️ - Analyzing Data Traffic" ))
271+
272+ val progress = progressBarLayout {
273+ spinner(Spinner .Dots ())
274+ timeElapsed()
275+ progressBar()
276+ completed()
277+ timeRemaining(style = terminal.theme.info)
278+ }.animateInCoroutine(terminal)
279+
280+ progress.update { this .total = (2 .. 10 ).random().toLong()}
281+
282+ val job = launch { progress.execute() }
283+ while (! progress.finished) {
284+ val title = processJargon.random()
285+ val size = " (${(10 .. 100 ).random()}${processingJargonSizes.random()} )"
286+ val suffix = " ${(1000 .. 5000 ).random()} ${processingJargonSuffix.random()} "
287+
288+ terminal.info(" \uD83D\uDD03 ${processingJargonPrefix.random()} $title | $suffix $size " )
289+ for (i in 0 .. (0 .. 10 ).random()) {
290+ terminal.println (
291+ " - ${processingJargonPrefix.random()} ${processSubJargon.random()} ${(mutableListOf (" logic" ) + processingJargonSuffix).random()} "
292+ )
293+ delay((10 .. 200 ).random().toLong())
294+ }
295+
296+ if (Random .nextBoolean()) terminal.println (terminal.theme.success(" ✅ ${fetchJargon()} " ))
297+ delay((10 .. 800 ).random().toLong())
298+ progress.advance(1 )
299+ }
300+
301+ job.join()
302+ terminal.println (" " )
303+
304+ terminal.info(
305+ """
306+ ${TextColors .cyan(" \uD83D\uDCCA - Data Processing Summary:" )}
307+ - Records processed: ${(2500 .. 10000 ).random()}
308+ - Processing rate: ${(100 .. 5000 ).random()} records/sec
309+ - Total data size: ${(15 .. 300 ).random()} ${processingJargonSizes.random()}
310+ - Estimated time saved: ${(25 .. 100 ).random()} minutes
311+ - ${fetchJargon()}
312+
313+ """ .trimIndent()
314+ )
315+ }
239316}
0 commit comments