Life is too short for Bash programming
MIT License
A starter project to build command-line tools in Kotlin Multiplatform
Contains a re-implementation of a real world CLI tool: git-standup
You can install using one of the options listed below
Source | Command |
---|---|
Node | npm install -g kotlin-cli-starter |
Installer | curl -L https://raw.githubusercontent.com/jmfayard/kotlin-cli-starter/main/installer.sh | sudo sh |
Tests | ./gradlew allTests |
Kotlin All Platforms | Run ./gradlew allRun
|
Kotlin JVM | Run ./gradlew run
|
Kotlin Native | Run ./gradlew install then $ git standup
|
Kotlin Node.JS | Run ./gradlew jsNodeRun
|
Being able to write your own command-line tools is a great skill to have. Automate all the things!
You can write the CLI tools in Kotlin and reap the benefits of using
My strong opinion - weakly held - is that there are only two good kind of Bash scripts:
We want to support Windows, publish on Homebrew and simplify support of shell completion.
Look at the issues https://github.com/jmfayard/kotlin-cli-starter/issues
The template
$ ./gradlew install
and then git-standup
$ ./gradlew run
$ ./gradlew jsNodeRun
. The package is published on https://www.npmjs.com/package/kotlin-cli-starter
$ ./gradlew nativeTest
$ ./gradlew desktopTest
$ ./gradlew jsTest
runBlocking { ... }
in commonTests
git-standup
The template reimplements git-standup
so that you can learn and find inspiration from a real world example.
Simply run it in and it will give you the output from the last working day
Open a directory having multiple repositories and run
$ ./gradlew install
$ git standup
This will show you all your commits since the last working day in all the repositories inside.
There is auto-completion to see the options
git standup --help
Usage: git-standup [OPTIONS]
Recall what you did on the last working day ..or be nosy and find what
someone else did.
Options:
--generate-completion [bash|zsh|fish]
-a, --author TEXT Specify author to restrict search to
-b, --branch TEXT Specify branch to restrict search to
(unset: all branches, "$remote/$branch" to
include fetches)
[... and much more options....]
Examples: git-standup -a "John Doe" -w "MON-FRI" -m 3
So are you ready to write your own command-line tool?
Have you an idea of what you want to write yet?
You can find some inspiration in 15 Command Line Tools which Spark Joy in Your Terminal
Then click on Use this GitHub template
There are comments starting with CUSTOMIZE_ME in all places you need to customize
Find them with Edit > File > Find in Files
Have you used the template to build something? Please advertise it here 🙏🏻