is it possible to in include a filepath wildcard in a lein alias?
goals is to have this in my aliases map
"format" ["zprint" "src/**/*.clj"]
i end up getting this error however
Unable to process file: src/**/*.clj because: <http://java.io|java.io>.FileNotFoundException: src/**/*.clj (No such file or directory) Leaving it unchanged!
@chadhs is src/**/*.clj
shell syntax? I see that ls src/**/*.clj
lists Clojure files, with a bit different behavior on Bash and Zsh.
@teodorlu yes it is
interesting… sh and bash do behave differently than zsh with that
I'd consider either looking into if zprint supports file search itself, or try to make some pipeline. If you want to go for the pipeline approach, something like
find src -iname '*.clj' | xargs echo
could work. When run from Lein, I suspect you'll have to bash -c
or similar to get the pipe to work.
bash -c 'find src -iname "*.clj" | xargs echo'
Not sure if it's a good idea to put that thing into a lein alias. You'll be the judge 🙂
@teodorlu it’s not pretty but i have a format.sh with this
#!/usr/bin/env zsh
unset CLASSPATH
lein zprint src/**/*.clj*
and an alias using lein-shell like this
"format" ["shell" "./format.sh"]
Nice! -- Well, depends on our definition of nice. Glad you got it working 🙂
Seems like a good case for ZSH, actually. As long as ZSH is installed.
that’s the rub. not sure if i want to rely on that. it’s on macs by default; so i’ll have to think on that more.
goal is pre-commit hook that will format with zprint and then lint with clj-kondo all using dev deps and aliases in project.clj so there’s no reliance on having the os binaries of those tools installed.
Is find
preinstalled on macs? I don't think I've found a Linux system missing it.
lein zprint `find src -iname '*.clj'
`yes, since it’s a BSD under the hood. of the utils are a bit different than their GNU counterparts, but yes find is there ^_^
I’m trying to use :pedantic :abort?
to make sure I have no ambiguous dependencies, but it doesn’t appear to behave the way I’d like. For example, I currently have
[s3-wagon-private "1.3.3"] -> [com.fasterxml.jackson.core/jackson-core "2.9.9"]
overrides
[s3-wagon-private "1.3.3"] -> [com.fasterxml.jackson.core/jackson-databind "2.9.10.1"] -> [com.fasterxml.jackson.core/jackson-core "2.9.10"]
but jackson-core is in :managed-dependencies
, so I’d expect that there aren’t problems with that depIs there a different way to achieve this?
Not sure if :plugins works with :managed-dependencies?