weavejester/cljfmt

[standalone] Processing STDIN weird behavior

arichiardi opened this issue · 2 comments

Hi there, trying to pass file paths to cljfmt via stdin but this is what I see:

echo "deps.edn\nbuild.clj" |  cljfmt --verbose fix -
Processing file: STDIN
Failed to format file: STDIN

above nothing happens and in the following it does not process deps.edn:

echo "deps.edn" |  cljfmt --verbose fix -
Processing file: STDIN
deps.edn

Is there any problem in my shell commands or is this a bug?

cljfmt expects Clojure code via STDIN, not a list of files. If you want a list of files, pass them as arguments (possibly using xargs).

Oh I see - thank you - I think I can close this.

I was initially passing file paths as args but one weird thing you need to account for is that if your list of files is empty (say you grep on it and/or post process it), cljfmt will format every file. In any case, unrelated to this and some bash glue solves the problem.