Tools for Kotlin/Kscript to easy write shell command line in kotlin code

Overview

Kscript Tools

Easy way to run shell command line in kotlin and other tools

Usage

Used in kscript:

@file:DependsOn("com.sealwu:kscript-tools:1.0.2")

Used in normal kotlin gradle projects

add into gradle dependencies

dependencies {
    implementation("com.sealwu:kscript-tools:1.0.2")
}

APIs

runCommand

Run a bash/shell command in kotlin code, also can run multi-lines bash/shell scripts

execute next kotlin code

"ls".runCommand()

output on console:

Applications   Downloads      MavenDep       Pictures       iOSProjects
Desktop        IdeaProjects   Movies         Public         scripts
Documents      Library        Music          StudioProjects

evalBash

Run a bash/shell command in kotlin code, also can run multi-lines bash/shell scripts, The different with runCommand is that it can get the command run standard output and error output

execute next kotlin code

val date = "date".evalBash().getOrThrow()  //execute shell command `date` and get the command's output and set the content to date variable
println(date) //This will print Fri Aug 19 21:59:56 CEST 2022 on console
val year = date.substringAfterLast(" ") // will get 2022 and assign to `year`
println(year)

output on console:

Fri Aug 19 21:59:56 CEST 2022
2022
You might also like...
 🍲Foodium is a sample food blog Android application 📱 built to demonstrate the use of Modern Android development tools - (Kotlin, Coroutines, Flow, Dagger 2/Hilt, Architecture Components, MVVM, Room, Retrofit, Moshi, Material Components). A complete Kotlin application built to demonstrate the use of Modern development tools with best practices implementation using multi-module architecture developed using SOLID principles
A complete Kotlin application built to demonstrate the use of Modern development tools with best practices implementation using multi-module architecture developed using SOLID principles

This repository serves as template and demo for building android applications for scale. It is suited for large teams where individuals can work independently on feature wise and layer wise reducing the dependency on each other.

Tools & tips to learn about recomposition in Jetpack Compose

⚡ Recomposition in Jetpack Compose List of practical tips and code snippets to avoid unnecessary recomposition in Jetpack Compose. This is an active r

Scaloid makes your Android code easy to understand and maintain.

Simpler Android Scaloid is a library that simplifies your Android code. It makes your code easy to understand and maintain by leveraging Scala languag

Advent of Code 2021 in Kotlin, solved by myself. Focus on code readability. With GitHub Actions all puzzles are executed and their solutions printed

Advent of Code 2021 in Kotlin Focus on Code Readability. With CI Solution Printing. Welcome to the Advent of Code1 Kotlin project created by michaeltr

Amazing and easy to use Accordion Library for Android built with kotlin
Amazing and easy to use Accordion Library for Android built with kotlin

AccoLib An easy-to-use, amazing Accordion Library for Android built with kotlin. It reduces the amount of code needed to make Accordions in android, w

Jetpack Compose for Desktop and Web, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
Jetpack Compose for Desktop and Web, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.

Jetpack Compose for Desktop and Web, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.

Katoot - An easy-to-use (blocking) Kotlin wrapper for Kahoot's REST api

katoot An easy-to-use (blocking) Kotlin wrapper for Kahoot's REST api. Usage Qui

AGStateMachineBuilder - a library for easy creation of state machines using advanced concepts of kotlin

This is a library for easy creation of state machines using advanced concepts of kotlin. As of 2/15/2022, this library only works in kotlin, but will be expanded to work in Java later (whenever I get bored enough to rewrite an entire code structure in java :/ )

Owner
Seal
Ho lu Ho lu
Seal
A command-line student management system in Kotlin

Student Management System Done as a part of NITK GSDC Android Study Jams 2021 Th

Ranjana Kambhammettu 2 Dec 24, 2021
Android application compatible with ZX2C4's Pass command line application

Password Store Download Documentation We're in the process of rewriting our documentation from scratch, and the work-in-progress state can be seen her

Android Password Store 2.1k Sep 25, 2022
An interactive command line interface to a transactional key value store

Transactional Key-Value Store An interactive command line interface to a transactional key value store. Commands: SET <key> <value> // store the value

Eugene 0 Jan 14, 2022
DS-for-Kotlin - Some classic data sturctures write in kotlin for fun

DS-for-Kotlin Just write some classic data structure by kotlin during my leisure

ccyyxx 2 Jan 30, 2022
kotlin eval command for minestom

k Kotlin debugging evaulator in Minestom. Usage /k is shorthand, /ko is longhand requires the permission "k.ok" and "k.store" for running scripts and

Cepi 3 Jun 20, 2022
🐹 Kotlin microservice to aid slash command creation for Nino.

slash-commands ?? .Kotlin microservice to aid slash command creation for Nino. More of this README will be fixed up once the first release is here. Li

Nino 5 Oct 1, 2021
🌨️ Simple, intuitive, and opinionated command handling library for Kord

??️ Snow Simple, intuitive, and opinionated command handling library for Kord Why? Since I maintain two Discord bots, both in Kotlin, Nino and Noel (p

Noel ʕ •ᴥ•ʔ 1 Jan 16, 2022
Commands - Simple work in progress command framework

Commands Purpose commands is a performant, flexible, future-rich, and easy-to-us

rawr 7 Mar 19, 2022
Kotlin-phoenix - A set of tools aimed to bridge Phoenix with the Kotlin Multiplatform world

Kotlin Phoenix This project is aimed to allow developers to work with Phoenix Ch

Adrien Jacquier Bret 5 Sep 21, 2022
📒 NotyKT is a complete 💎Kotlin-stack (Backend + Android) 📱 application built to demonstrate the use of Modern development tools with best practices implementation🦸.

NotyKT ??️ NotyKT is the complete Kotlin-stack note taking ??️ application ?? built to demonstrate a use of Kotlin programming language in server-side

Shreyas Patil 1.3k Sep 25, 2022