{"id":17182196,"url":"https://github.com/wuseal/kscript-tools","last_synced_at":"2025-03-23T18:31:22.713Z","repository":{"id":65461197,"uuid":"526738197","full_name":"wuseal/Kscript-Tools","owner":"wuseal","description":"Tools for Kotlin/Kscript to easy run shell command in kotlin code","archived":false,"fork":false,"pushed_at":"2024-01-19T22:33:45.000Z","size":81,"stargazers_count":23,"open_issues_count":2,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-18T22:35:50.671Z","etag":null,"topics":["command","kotlin","kscript","shell"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wuseal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-08-19T20:07:14.000Z","updated_at":"2024-09-29T02:18:06.000Z","dependencies_parsed_at":"2024-01-19T23:45:08.957Z","dependency_job_id":null,"html_url":"https://github.com/wuseal/Kscript-Tools","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuseal%2FKscript-Tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuseal%2FKscript-Tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuseal%2FKscript-Tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuseal%2FKscript-Tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wuseal","download_url":"https://codeload.github.com/wuseal/Kscript-Tools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245149224,"owners_count":20568851,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command","kotlin","kscript","shell"],"created_at":"2024-10-15T00:36:18.421Z","updated_at":"2025-03-23T18:31:22.447Z","avatar_url":"https://github.com/wuseal.png","language":"Kotlin","readme":"# Kscript Tools\n\nEasy way to run shell command line in kotlin and other tools\n\n## Usage\n\n### Used in [kscript](https://github.com/holgerbrandl/kscript):\n\n```kotlin\n@file:DependsOn(\"com.sealwu:kscript-tools:1.0.22\")\n```\n\n### Used in normal kotlin gradle projects\n\nadd into gradle dependencies\n\n```kotlin\ndependencies {\n    implementation(\"com.sealwu:kscript-tools:1.0.22\")\n}\n```\n\n## APIs\n\n### `runCommand`\nRun a bash/shell command in kotlin code, also can run multi-lines bash/shell scripts\n\nexecute next kotlin code\n```kotlin\n\"ls\".runCommand()\n```\noutput on console:\n```shell\nApplications   Downloads      MavenDep       Pictures       iOSProjects\nDesktop        IdeaProjects   Movies         Public         scripts\nDocuments      Library        Music          StudioProjects\n```\n\n### `evalBash`\nRun a bash/shell command in kotlin code, also can run multi-lines bash/shell scripts,\nThe different with `runCommand` is that it can get the command run standard output and error output\n\nexecute next kotlin code\n```kotlin\nval date = evalBash(\"date\").getOrThrow()  //execute shell command `date` and get the command's output and set the content to date variable\nprintln(date) //This will print Fri Aug 19 21:59:56 CEST 2022 on console\nval year = date.substringAfterLast(\" \") // will get 2022 and assign to `year`\nprintln(year)\n```\n\noutput on console:\n```shell\nFri Aug 19 21:59:56 CEST 2022\n2022\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwuseal%2Fkscript-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwuseal%2Fkscript-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwuseal%2Fkscript-tools/lists"}