https://github.com/tiulpin/kotlin-cv.js
🚀 CLI-like personal webpage built with Kotlin/JS
https://github.com/tiulpin/kotlin-cv.js
cv kotlin-js kotlinx-html
Last synced: about 1 month ago
JSON representation
🚀 CLI-like personal webpage built with Kotlin/JS
- Host: GitHub
- URL: https://github.com/tiulpin/kotlin-cv.js
- Owner: tiulpin
- License: apache-2.0
- Created: 2021-10-26T05:09:58.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-19T11:52:05.000Z (almost 2 years ago)
- Last Synced: 2025-05-07T11:18:04.457Z (about 1 month ago)
- Topics: cv, kotlin-js, kotlinx-html
- Language: Kotlin
- Homepage: https://tiulp.in/
- Size: 248 KB
- Stars: 13
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# kotlin-cv.js
[](https://github.com/tiulpin/kotlin-cv.js/actions/workflows/quality.yml)
[](https://github.com/tiulpin/kotlin-cv.js/actions/workflows/build.yml)Personal terminal-like simple webpage template built with [Kotlin/JS](https://kotlinlang.org/docs/js-overview.html).

The template features CLI commands `help`, `cat`, `ls`, their completion and execution, and it's easy to implement your commands. The original idea of the CLI-like webpage is borrowed from the cool [zenith.tech](zenith.tech) website.
## Build and run
The built website contains three files:
- [`styles.css`](src/main/resources/styles.css) – fancy styles for the website
- [`index.html`](src/main/resources/index.html) – boilerplate HTML doc that contains call to `kotlin-cv.js`
- `kotlin-cv.js` – the "CLI" core, built with Kotlin/JS.To set up a website like this, follow these steps:
- Use the template
- To run the project locally, use `./gradlew run`, to build – `./gradlew build`: the built website will be located at `./build/distributions`.
- Deploy it anywhere you want, the website [can be easily deployed to GitHub Pages](https://dev.to/kotlin/hosting-kotlin-js-on-github-pages-via-github-actions-3gep). I build it with Actions and use [Cloudflare Pages](https://pages.cloudflare.com) for [tiulp.in](https://tiulp.in/)### F.A.Q.
#### How to change the prompt
Edit [the code](src/main/kotlin/Main.kt) that generates HTML with kotlinx:
```kotlin
div("prompt") {
pre {
+"@kotlin › "
}
}
```#### How to add a new command
Implement an object from the Command interface and add it to [the commands list](src/main/kotlin/Commands.kt). For example, a command to open some link (in this particular example is URL to CV) could be implemented this way:
```kotlin
"cv" to object : Command {
override val help = "open my cv"
override fun complete(argv: List): List = listOf()
override fun exec(argv: List, print: (String) -> Unit) =
window.open("https://tiulp.in/cv.pdf", blank)!!.focus()
}
```#### How to add "files"
Add a new "file" to [the "files" list](src/main/kotlin/Files.kt).
#### How to insert HTML from a string
Use `unsafe`:
```kotlin
p {
unsafe {
+""
}
}
```