Kleiner - CLI to set up distribution of other clis
Let's face it, go is an excellent tool to build self contained clis, however
there is always a question of distribution. You could ask your friends to download
new binary from the releases page, however wouldn't it be cooler to have a cli
that can report about updates and update itself?
This has been done many times, however kleiner allows to do that at scale
since it's so damn easy to generate yet another cli and have it's distribution
set up immediately. All you need to do is to add your commands and you're done.
We don't need to have another tool for scaffolding, hence please have cobra-cli
installed.
Dependencies:
- goreleaser to build binaries for us
- git && github to keep the project and do releases
- go to build the project
GITHUB_TOKEN in the shell environment
Installation
Install Script
Download kleiner and install into a local bin directory.
MacOS, Linux, WSL
Latest version:
curl -L https://raw.githubusercontent.com/can3p/kleiner/main/generated/install.sh | sh
Specific version:
curl -L https://raw.githubusercontent.com/can3p/kleiner/main/generated/install.sh | sh -s 0.0.4
The script will install the binary into $HOME/bin folder by default, you can override this by setting
$CUSTOM_INSTALL environment variable
Manual download
Get the archive that fits your system from the Releases page and
extract the binary into a folder that is mentioned in your $PATH variable.
Inspiration
The code is inspired a lot and uses parts of the flyctl code. The files
with the borrowings mention this explicitly.
FAQ
Why is the project named kleiner?
Because it's a cool dutch word! It also bears some similarity with CLI acronym
I think it's useful to be able to be able to start shipping tools in the smallest possible stretch of time.
Kleiner will help you to get going with no strings attached - the shared code is small, you can move it to
your project and have it under your full control if you want.
Why cobra?
Decisions are hard and to be frank most of the cli handling packages are just fine and any of them would do.
You're not tied to cobra in any way, all the included commands are just tiny wrappers that can be replaced
by the wrappers that use any other library.
Why github?
I keep my projects on github and github gives a nice API to create releases and upload artifacts. It
should be dead easy to add support for gitlab or any other service with comparable feature set.
Why not proper packaging?
Since all the building and packaging is done by goreleaser, you are free to build any packages it supports.
The purpose of the structure generated by klein is to specifically bypass traditional packaging solutions
in order to deliver instant updates.
If you want to build a cool tool for your company or your friends, you don't want to waste a week trying to
build proper packages for the whole zoo of operating systems and architectures available, decide where
to host repositories and so on.
Why not setup CI?
The idea is to have the simplest setup possible, local setup fits this scenario
TODO
- Windows support
- Dependencies check (goreleaser, go)
- Make it possible to generate scaffolding for other git hostings
- Much better validation and error checking
License
Apache 2.0