Skip to content
/ kotlin-cv.js Public template

๐Ÿš€ CLI-like personal webpage built with Kotlin/JS

License

Notifications You must be signed in to change notification settings

tiulpin/kotlin-cv.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

kotlin-cv.js

Code Quality Build

Personal terminal-like simple webpage template built with Kotlin/JS.

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 website.

Build and run

The built website contains three files:

  • styles.css โ€“ fancy styles for the website
  • 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:

F.A.Q.

How to change the prompt

Edit the code that generates HTML with kotlinx:

div("prompt") { 
    pre {
        +"@kotlin โ€บ " 
    }
}

How to add a new command

Implement an object from the Command interface and add it to the commands list. For example, a command to open some link (in this particular example is URL to CV) could be implemented this way:

"cv" to object : Command {
    override val help = "open my cv"
    override fun complete(argv: List<String>): List<String> = listOf()
    override fun exec(argv: List<String>, print: (String) -> Unit) =
        window.open("https://tiulp.in/cv.pdf", blank)!!.focus()
}

How to add "files"

Add a new "file" to the "files" list.

How to insert HTML from a string

Use unsafe:

p {
    unsafe {
        +"</br>"
    }
}