https://github.com/abogoyavlensky/tiny-cli 0.2.1 - a zero-dependency CLI argument parser for let-go, Clojure, and Babashka.
Iโm announcing the first public release of tiny-cli. Itโs a small library for building CLI apps. It provides a declarative app spec for describing commands and args, Unix-style options, generated help, simple validation, and built-in shell completion (for bash, zsh or fish) that you can extend dynamically for any arg or option.
You can try it by building your first self-contained binary CLI app with let-go:
brew install abogoyavlensky/tap/lgx nooga/tap/let-go
lgx new hellocli -t cli
cd hellocli
lgx build && bin/hellocli
Example output:
hellocli - An example command-line application.
Usage:
hellocli [global options] <command> [options] [args]
Commands:
hellocli greet Greet the user.
hellocli help [command] Show a command help.
hellocli --help Show the tool help.
hellocli --version Print version.
@plexus I'll check it out, will probably need some :lg reader macro patches
@dominicm @seancorfield Hi, Iโm happy to share that the next release of let-go will support clojure.tools.cli. An example can be found https://github.com/abogoyavlensky/lgx/blob/master/examples/clojure-libs/with-tools-cli/main.lg and, for now, can be executed like this with let-go, built from current main branch:
cd lgx/examples/clojure-libs/with-tools-cli
LGX_LG=/path/to/let-go/lg lgx testAwesome! I need to get let-go installed to play with ๐ So many dialects to keep up with these days... Is there a recommended GitHub Actions CI setup to test libraries against let-go?
Iโve found the simplest way for me to run lgx/lg in Github Actions using https://github.com/abogoyavlensky/tiny-tui/blob/80e1f6909dfbd1c569473cb0056ae34dd4b5a921/.mise.toml#L3-L4 and https://github.com/abogoyavlensky/skl/blob/4603dfd2a503e5d764594cf9c2bd3f97032ca81c/lgx.edn#L6-L9, an example can be found at tiny-tui libโs https://github.com/abogoyavlensky/tiny-tui/blob/3d2aeaa68e4647187c10cbbcba7df881b81b9a6c/.github/workflows/checks.yml#L11-L21:
jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: jdx/mise-action@v3
- name: Run tests
run: lgx test
If you want to play with let-go locally, also homebrew formula is available:
brew install nooga/tap/let-go
Or mise mise use -g github:nooga/let-go@latest, or downloading native binaries from https://github.com/nooga/let-go/releases/tag/v1.11.1.
To add dependencies you can use bare lg -source-paths <โฆ> locally, or lgx with lgx.edn and :deps key with git/url and git/sha similar as for tools.deps.@seancorfield You might be interested in https://clojure.cc/cli/#starting-dialect-repls
I'm going to need to pull this in. ๐
Currently it does not work with let-go - it was primary reason.
I wonder if something data-compatible would work ๐ค Data is very portable, which is nice.
I maintain clojure.tools.cli and would be interested to know what changes are needed for let-go compatibility?
I'd also be open to accomodate changes in babashka.cli. it works in at least 3 dialects now ;)
I like reading "let-go, Clojure, and Babashka" in one sentence ๐
Lambdaisland/cli should be pure Clojure (it's already cljc). Would love to get reports if it doesn't work on any of the dialects.
https://github.com/gloathub/gojava now mirrors https://github.com/jolt-lang/jolt/tree/main/host/chez/java for Java's common java classes and https://github.com/gloathub/gojava-clojure also mirrors jolt for Clojure's commonly used java classes
It would be great to get lg and glj both using the same code for jvm interop
I too am quite curious if any of the existing CLI libraries can be made to work with let-go.
@xnooga would you be interested in a report on what's missing in terms of clojure compatibility?
@plexus always! reading THIS_BRANCH
@plexus this is really good, I think we can implement everything ๐ค I'll get back to you once it's released
woot! awesome
@ingy has been working on a Java compatibility shim. I doesn't have IO in there yet (eg. java.io.File), but maybe that would make sense? Maybe not?
https://github.com/gloathub/gojava
or just use babashka.fs - port it to let-go and then use everywhere ;P
it already runs on Node.js too
@yogthos has gone much further with https://github.com/jolt-lang/jolt/tree/main/host/chez/java Java in chez scheme. I plan to add that all to gojava. ๐
I was pretty sure lg has java.io.File ๐
as it turns out, it does not
Glojure uses gojava so that it adds the most common Java interop (clojure with basic JVM interop just works) and has complete Go interop. THe goal is for most existing clj code to just work or require minimal change. Then use Go interop for stuff you want from there.
@xnooga lg should just be using gojava. no?
then glj and lg are in parity there
I think we will adopt gojava in lg, need to get on top current changes before we start on this
> need to get on top current changes I think @nnunley would concur with that ๐
and me. I have about 10 commits in the lg queue.