Skip to content

Commit 76402b2

Browse files
OlyOly
authored andcommitted
minor stuff
1 parent 8106378 commit 76402b2

File tree

4 files changed

+29
-23
lines changed

4 files changed

+29
-23
lines changed

.idea/misc.xml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ Introducing Kotlin Encabulator, the newest (shameless [rust-stakeholder](https:/
1111

1212
Never again run out of excuses for a coffee break, or look unwise, or be seen as a slacker. Anyone who looks at your terminal from now on shall forever be impressed by the sheer amount of bullsh\*t coursing through your fancy MacBook.
1313

14-
> "Before using the Encabulator I was on the verge of being fired, due to the high complexity of compiling rust on windows other offers such as [rust-stakeholder](https://github.com/giacomo-b/rust-stakeholder/blob/master/README.md) just didn't cut it. Now I am senior software assurance specialist!"
14+
> "Before using the Encabulator I was on the verge of being fired, due to the high complexity of compiling rust on Windows. Other offers such as [rust-stakeholder](https://github.com/giacomo-b/rust-stakeholder/blob/master/README.md) just didn't cut it. Now I am senior software assurance specialist!"
1515
- Erick, vibecoder.
1616

17-
The Encabulator works by high-jacking one simple concept of human psychology, via the natural neutrals pathways relevant to the Stroheim response complex one is capable of leveraging zeta waves to induce an aura of expertise to be projected upon the encabulatee. That is, print a torrential downfall of eldritch error codes, logger debug information and progress bars to the terminal and hope whoever's supposed to sign one on your paycheck believe that, YOU, are a productive member of this enterprise!
17+
The Encabulator works by high-jacking one simple concept of human psychology, via the natural neutrals pathways relevant to the Stroheim response complex.
18+
One is capable of leveraging zeta waves to induce an aura of expertise to be projected upon the encabulatee.
19+
That is, print a torrential downfall of eldritch error codes, logger debug information and progress bars to the terminal and hope whoever's supposed to sign on one of your paychecks believe that...
20+
YOU, yes... YOU! Are a productive member of this enterprise! (utter delusion)
1821

1922
## Included in every copy
2023
---
@@ -28,17 +31,19 @@ The Encabulator works by high-jacking one simple concept of human psychology, vi
2831
After years of work, the Kotlin Encabulator has reached a high level of development. As such, the installation instructions for this **wonder technology** have been simplified drastically.
2932
Simply copy the command for your matching Operating System directly in a console window to install the program. Very secure, we know!
3033

31-
### Windows (x86)
34+
### Windows (AMD64)
3235
```sh
3336
powershell -ExecutionPolicy ByPass -c "irm https://raw.githubusercontent.com/Olypolyu/Kotlin-Encabulator/master/script/install-win.ps1 | iex"
3437
```
3538

36-
### Linux (x86)
39+
### Linux (AMD64)
3740
```sh
3841
curl -s "https://raw.githubusercontent.com/Olypolyu/Kotlin-Encabulator/master/script/install-linux.sh" | sh
3942
```
43+
4044
### Jar
41-
We normally compile the jar output to a native image with GraalVM.
42-
However, if you have problems with that binary, say, you're an ARM/RISC-V user.
45+
**🎯 Disclaimer:** You might need to set up Java.
4346

44-
You can download the raw Jar file to run with your system's Java implementation [here](https://github.com/Olypolyu/Kotlin-Encabulator/releases)
47+
We normally compile the jar output to a native image with GraalVM.
48+
However, if you have problems with that binary. Let's say... you're an **ARM**/**RISC-V** user... \
49+
You can download the raw Jar file to run with your system's Java implementation [here.](https://github.com/Olypolyu/Kotlin-Encabulator/releases)

src/main/kotlin/Main.kt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ import com.github.ajalt.clikt.parameters.options.help
77
import com.github.ajalt.clikt.parameters.options.option
88
import com.github.ajalt.clikt.parameters.types.choice
99
import com.github.ajalt.clikt.parameters.types.enum
10+
import com.github.ajalt.mordant.rendering.AnsiLevel
1011
import com.github.ajalt.mordant.terminal.Terminal
1112
import kotlinx.coroutines.runBlocking
1213
import org.example.data.BackendDataSource
1314
import org.example.data.DataSource
1415

15-
val terminal = Terminal()
16-
1716
val environments: Array<String> = arrayOf(
1817
"backend"
1918
)
@@ -36,13 +35,24 @@ class Application: CliktCommand() {
3635
.default(JargonLevel.MEDIUM)
3736
.help("Describes how hard the jargon will be to understand.")
3837

38+
private val ansiLevel: AnsiLevel? by option("-a", "--ansii")
39+
.enum<AnsiLevel>()
40+
3941
override fun run() = runBlocking {
4042
val sourceClass: Class<out DataSource> = when (environmentType) {
4143
"backend" -> BackendDataSource::class.java
42-
4344
else -> throw UnknownError("\"$environmentType\" does not match a dataSource provider.")
4445
}
4546

47+
val terminal = Terminal(
48+
ansiLevel = ansiLevel
49+
)
50+
51+
terminal.cursor.move {
52+
setPosition(0,0)
53+
clearScreen()
54+
}
55+
4656
val source = sourceClass
4757
.getConstructor(Terminal::class.java, JargonLevel::class.java, String::class.java, String::class.java)
4858
.newInstance(terminal, jargonLevel, projectName, environmentName)
@@ -52,11 +62,6 @@ class Application: CliktCommand() {
5262
}
5363

5464
suspend fun encabulate(source: DataSource) {
55-
terminal.cursor.move {
56-
setPosition(0,0)
57-
clearScreen()
58-
}
59-
6065
source.initEnvironment()
6166

6267
while (true) {

src/main/kotlin/data/DataSource.kt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ abstract class DataSource(
104104
val num = a.range.random()
105105
val (label, isGood) = a.labelFn(num)
106106

107-
val str = "$fileName - ${a.name}: $num${a.suffix} ($label)"
108-
if (isGood) terminal.info("✅ - $str") else terminal.warn("⚠️ - $str")
109-
107+
terminal.println(" ${if(isGood) "" else "⚠️"} - $fileName - ${a.name}: $num${a.suffix} ($label)")
110108
delay((10..700).random().toLong())
111109
progress.advance(1)
112110
}
@@ -121,7 +119,6 @@ abstract class DataSource(
121119
terminal.info(TextColors.cyan("📊 - Analysis Results: $total files, ${total * (200..2000).random()} lines of code"))
122120
for (r in results) println(" - $r")
123121
println(" ")
124-
125122
}
126123

127124
suspend fun monitorSystemResources() = coroutineScope {
@@ -138,7 +135,7 @@ abstract class DataSource(
138135

139136
var processes = (30..1000).random()
140137
while (!progress.finished) {
141-
terminal.info(
138+
terminal.println(
142139
listOf(
143140
"CPU: ${(0..100).random()}%".padEnd(9),
144141
"RAM: ${(0..100).random()}%".padEnd(9),
@@ -149,7 +146,7 @@ abstract class DataSource(
149146
)
150147

151148
processes += ((-100)..100).random()
152-
delay(1000)
149+
delay(250)
153150
progress.advance(1)
154151
}
155152

@@ -218,7 +215,7 @@ abstract class DataSource(
218215
val endpoint = itr.next().padEnd(8 + maxPadding)
219216
val ms = "${(72..1000).random()}ms".padEnd(5)
220217
val size = "${(225..1000).random()}KB".padEnd(5)
221-
terminal.info("$method $endpoint -> $numStr | $ms | $size")
218+
terminal.println(" $method $endpoint -> $numStr | $ms | $size")
222219

223220
delay((10..800).random().toLong())
224221
progress.advance(1)

0 commit comments

Comments
 (0)