Fork me on GitHub
#babashka
<
2022-07-10
>
Darrick Wiebe18:07:25

Hey, I like the idea of having a library of stuff available to me in my ~/.clojure/deps.edn file, but I never remember the (ever-changing) aliases there. So I made this handy little bb script. Perhaps it'll be useful to some one else too. https://gist.github.com/pangloss/ca648ea996755347c6e86bd495f9d644

👍 1
Darrick Wiebe18:07:18

Example usage:

aliases -s test
Filtering by substring:  test

Global keys:

:env/test
:lib/spec-test
:test/cljs
:test/cloverage
:test/cognitect
:test/kaocha
:test/kaocha-cljs
:test/kaocha-global
:test/kaocha-watch
:test/midje
:test/run
:test/watch

Local keys:

:test

borkdude18:07:57

That's cool. Perhaps it can also let you invoke the alias. Like:

aliases run :test/watch

Darrick Wiebe18:07:37

Yeah, there are lots of directions it could go. If people have ideas, it's a perfect beginner project.

Darrick Wiebe18:07:18

Anyone wants to adopt it and turn it into a project, please do so, just let me know so I can use it!

borkdude18:07:56

There's also https://github.com/babashka/cli which lets you turn arguments like --foo --dude 123 into {:foo true :dude 123} automatically - perhaps useful when you want to build a nice shim over the -X stuff

👍 1
Alex Miller (Clojure team)18:07:59

btw, there is now clj -X:deps aliases that will list all your aliases and where they're from, adding search there would be easy to do

borkdude18:07:33

nice, didn't know that one yet

Darrick Wiebe18:07:34

It'd definitely be nice for that to be baked in and for this to be redundant.

borkdude18:07:16

Another idea. Darrick's script could also print a docstring provided by the user:

:aliases {:test {:doc "Run tests" ...}}
So the output would read:
Aliases:
:test - Run tests

👍 1
Darrick Wiebe18:07:44

For that to be most useful, @U064X3EF3's tool would encourage such good behaviours! 😉

Alex Miller (Clojure team)19:07:57

if you want to file the suggestion at https;<//ask.clojure.org> that would be helpful to remember. I'd probably want a qualifier though. I am thinking about various self-documentation/help aspects of all this stuff when I have time for work on it