clojure-dev

vlaaad 2024-03-06T15:38:47.906799Z

Wouldn’t it be cool if I could do clj test , and it could look at :test alias, notice that it has :main vec, and execute the equivalent of clj -M:test ? And similarly for :exec-fn args, it could do -X

leifericf 2024-03-09T09:55:45.804389Z

I’m always wrapping the Clojure CLI in shell aliases, a Makefile, or Babashka because the Clojure CLI interface is weird and unintuitive compared to all other command line tools I know. I need to look up the docs every time I need to do something with the Clojure CLI, even though I've done it many times before 😅 Some more intuitive “built-in aliases” for common tasks would be appreciated, indeed.

cjohansen 2024-03-09T09:58:39.982719Z

I agree that adding some shortcuts for conventional tasks is a good idea. Sure, lots of projects would not have all their testing needs covered by the suggested clj test but a whole lot of projects would be well served by it. And since it's an alias it doesn't come at the cost of anything, and you can still define it to be meaningful for your project.

2
cjohansen 2024-03-09T10:00:00.935629Z

I love that tools deps has designed for simple, but I think there's a lot of room for adding some easy convenience on top of it

2
vlaaad 2024-03-09T11:45:11.833599Z

I think a lot of people misunderstand what I'm talking about. Let me provide another example. Wouldn't it be cool if I could type clj foo, and it looked up the :foo alias, and executed appropriate -M or -X command depending on the contents of the :foo alias?

👍 4
💯 3
💡 2
🌈 1
🦄 1
1
2024-03-09T14:52:03.273899Z

Ooooh i see, that makes more sense

thheller 2024-03-06T15:52:26.794489Z

whats bad about just running clj -M:test or clj -X:test directly?

vlaaad 2024-03-06T16:04:27.032009Z

It's completely unrememberable

3
✅ 7
vlaaad 2024-03-06T16:05:08.216589Z

If you have more than say 5 repos, using any of them requires opening and reading deps.edn file

🤝 1
2024-03-06T16:05:48.898559Z

I think that would get confusing pretty quick, if you look at the ClojureScript compiler for example there are a bunch of aliases related to testing different aspects of it, like :compiler.test , :runtime.test or :selfhost.test etc, which is pretty common in many systems, where something like clj test wouldn't be well defined. I'm not saying there aren't better ways, but imho those shorter commands are always at odds with power

2024-03-06T16:51:05.647839Z

The -M:alias form would still exist for alternative test runs, but I think having a standard "test entrypoint" function would do a lot of good for discoverability and general usage

2
✅ 1
2024-03-06T17:09:48.208379Z

I agree, but then I would prefer something like aliases in shells, so they can be inspected. Like clj test internally expanding to clj -M:test or whatever, so when in doubt you can dump the "aliases" table and quickly figure out what is going on. I prefer that to something by convention, like "clj test will look at the :test alias and if it has a :main vec ...". A concept like that will enable short commands for a bunch of things without adding any complexity beyond support for aliases expansion and knowing there are aliases you can list. Although one problem unfortunately is the aliases word is already taken, which will make the concept confusing

vemv 2024-03-06T18:01:38.054699Z

Maybe stating the obvious, but I really like how I can type make test in a pretty wide variety of projects and have the tests run, whether it's a deps.edn, Lein or e.g. Python project - each of those with its own intricacies beyond the basic command syntax. First time (and that was a long time ago), Makefiles seemed to me the most unnecessarily arcane tech in existence, but nowadays they practically only bring joy (and speed, in form of caching).

💯 1
vemv 2024-03-06T18:03:45.598859Z

> Wouldn’t it be cool if I could do clj test , and it could look at :test alias, notice that it has :main vec, and execute the equivalent of clj -M:test ? What if there are :test-cljs, :test-integration, etc aliases? Running only :test could lead to running only a subset of tests (easily meaning false negatives in CI)

2024-03-06T18:13:19.813829Z

I've also been using Makefiles for a while and they work, but I guess most people use them as aliases for clj commands, so having support for that in the clj command could get rid of most uses of Makefiles, which are probably bizarre for people new to Clojure

✅ 1
vemv 2024-03-06T18:15:37.161999Z

Yeah that's fair, I recall some bitter HN comment claiming that the "only" way to make clj palatable is through Makefiles (implying they're a terrible thing)

2024-03-06T18:31:20.723529Z

Adding support for aliases that are combinations of other aliases (like -M:dev:test:runner) would solve some of this as well

💡 1
2024-03-06T18:48:48.607979Z

Unless there's a mechanism for running multiple mains in a row, combining aliases won't work like in leiningen, but it's at least shorter than it is right now