https://github.com/cortinico/kscript-template
đ Get started with kscript in a few seconds... with colored logs, github actions and more!
https://github.com/cortinico/kscript-template
github-actions github-templates hacktoberfest kotlin-scr kotlin-script kotlin-scripting kotlin-scripts kotlin-template kscript kts
Last synced: 10 months ago
JSON representation
đ Get started with kscript in a few seconds... with colored logs, github actions and more!
- Host: GitHub
- URL: https://github.com/cortinico/kscript-template
- Owner: cortinico
- License: mit
- Created: 2020-04-08T23:23:13.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T14:33:11.000Z (about 2 years ago)
- Last Synced: 2025-03-20T01:11:18.491Z (11 months ago)
- Topics: github-actions, github-templates, hacktoberfest, kotlin-scr, kotlin-script, kotlin-scripting, kotlin-scripts, kotlin-template, kscript, kts
- Language: Kotlin
- Homepage:
- Size: 14.6 KB
- Stars: 35
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kscript-template đ
[](https://github.com/cortinico/kscript-template/generate)   
A simple Github template that lets you create a [**kscript**](https://github.com/holgerbrandl/kscript) repository ready to run and share in a **few seconds**.
## How to use đŖ
Just click on [](https://github.com/cortinico/kscript-template/generate) button to create a new repo starting from this template.
Once created don't forget to update the:
- [Script name](scaffolded-script.kts) both the filename and the occurrencies inside the script.
- The script name inside the Github Actions [workflow file](.github/workflows/run-script.yaml).
The templated script is just printing the list of files from a input directory. You can use this as a starting point to create your script around it:
## Features đ¨
- Cli Args parsing with [picocli](https://github.com/remkop/picocli/).
- Logging functions `info`, `warn`, `error`, `success` with emoji support â
â ī¸â.
- Support for ASCII colored output đ¨.
- CI Setup with GitHub Actions.
- Publishing of bundled artifact out of the box.
- Issues Template (bug report + feature request).
- Pull Request Template.
## CLI Args â¨ī¸
This project is using [picocli](https://github.com/remkop/picocli/) to easily parse the CLI Options and Parameters. You can find more example on how to set up the flags on the [official documentation page](https://picocli.info/#_introduction).
You can use the `--help` flag to get a nice report for the available flags:
If you want to see how a failure looks like, invoke with `--fail` or `-f`:
## Logging đŖ
A couple of util functions are available for logging:
* âšī¸ `info` to report a info message. You can optionally provide an emoji to enrich the log.
* â
`succ` to report a green success message.
* â ī¸ `warn` to report a yellow warning message.
* â `error` to report an error. Optionally you can provide also:
- A `Throwable` that will be logged on the screen
- An exit code `Int`. If not provided the default is `1`
Calling `error` will also stop the script.
## CI âī¸
This template is using [**GitHub Actions**](https://github.com/cortinico/kscript-template/actions) as CI. You don't need to setup any external service and you should have a running CI once you start using this template.
The workflow [Run Script](https://github.com/cortinico/kscript-template/actions?query=workflow%3A%22Run+Script%22) will take care of running the script and publishing the bundled version of it as an artifact (users can easily download it).
## Contributing đ¤
Feel free to open a issue or submit a pull request for any bugs/improvements.