Skip to content
/ Khell Public

a simple and powerful command line executor with kotlin dsl, coroutine and multiplatform supported

Notifications You must be signed in to change notification settings

ElisaMin/Khell

Repository files navigation

Kotlin Shell

a lib just package the process for unnecessary things etc. Async Flow and Coroutines.

Help this project

yes, it could be more powerful some how #2

QuickStart

read the docs and code

it's a veeeeery simple lib with JUST 1 CORE FILE, and it's 200 lines code only. so just read it

Shell("echo hello world").await() {
    if (it is CommandResult.Success) it.let(::println)
}
Shell("ping xvidoes.com")
    .collect(::println)

val req = Shell {
    if ( foo ) 
        run("bar")
    if ( foo2 ){
        write("bar2")
        run()
    }
}
delay(3000)
req
    .await()
    .let(::doSth)

there has a log lib

import me.heizi.koltinx.loggger.error
import me.heizi.koltinx.loggger.println


class `class name as tag` {
    
    fun log(msg:String) 
        = this.println("msg-log",msg)
    
    fun err(msg:String)
        = this.error("msg-log",msg)
}

add to your project

with Gradle & Jitpack

maven

maven { url = uri("https://jitpack.io")}

dependencies

// required: coroutine
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")

// gradle.properties if you're
val khellVersion = extra["khell.version"] as String

// Khell
implementation("com.github.ElisaMin:khell:$khellVersion")
// or Khell Android
implementation("com.github.ElisaMin:khell-android:$khellVersion")
// or Khell JVM
implementation("com.github.ElisaMin:khell-jvm:$khellVersion")

// option: but JVM log impl must be
implementation("org.slf4j:slf4j-log4j12:+")

// option: the LOG lib
//implementation("com.github.ElisaMin:khell-log:$khellVersion")

with Gradle & GithubRepo

.....