pesterhazy / boot-fmt Goto Github PK
View Code? Open in Web Editor NEWBoot task to auto-format Clojure(Script) code
License: Eclipse Public License 1.0
Boot task to auto-format Clojure(Script) code
License: Eclipse Public License 1.0
Hi! Neat library. I'm sure glad you did this, since I know nothing about boot. I wouldn't have known where to even begin. I had to install boot to even try it!
This particular issue -- the extra newlines between all of my ;; comment
lines, is because you are using :parse-string-all?
with :interpose
. Turns out that :parse-string-all?
was added for @viebel (the fellow who wrote klipse
), as he wanted to use zprint to format multiple forms in a single string. I don't know if he ended up using it or not, but the :parse-string-all?
isn't friendly to anything between forms in the string. Rather, it treats them all alike, and puts the :interpose
between all of them.
I am pretty sure you could use zprint.core/zprint-file
, since at a quick look boot-fmt is operating on files. It doesn't mess with the formatting of anything that is considered "whitespace" in the file, and is what lein-zprint
uses. I would have no problem making that part of the documented API if you use it.
That would also give you support for the ;!zprint {<options-map}
capability for free. In case you haven't looked into it, the ;!zprint {<options-map>}
capability lets you put a comment in your source that changes the formatting for just the next function definition. For details, see the lein-zprint
readme. I put it in because I was doing my own files, and found some functions that really needed something other than the default formatting. If you don't want the ;!zprint
comments to work [I'll be sad, but] you can still use zprint-file
(sort of) in one of two ways.
zprint-file
but don't want ;!zprint support
, and I'll add an argument to zprint-file
to do what it does now w/out ;!zprint
support.zprint-file
yourself and change the call to process-multiple-forms
so that:process-bang-zprint?
is false
. I don't know how hard that would be to get it to link up with the other stuff in zprint.core
, but it would probably be possible.If you don't want ;!zprint
support, I would prefer that you ask for the change to zprint-map
, and I'll get it in the next release (due this weekend, I hope).
Specifically, zprint
Also clojure.tools.namespace should be a "test" dependency
Can you please update the zprint dependency to the latest release (currently 0.4.2).
Thanks!
A nice enhancement would be to find some way to get the various modes to show up in the --help
output. Kind of a nit, I suppose, but would have helped me and might help others. I looked briefly at the code to see where you did the --help
, and didn't find it, so it may not be trivial to get it to do more than it does now.
We want to use boot-fmt
but we need some features from a newer zprint, Would it be an idea to give the version of print as a option to boot-fmt
? This would not make it necessary to cut a new release each time a new zprint get's released.
Should they be formatted differently from .clj files?
Here's a minimal test case I could find:
false
:➜ fmt-test boot -d boot-fmt fmt --options "{:map {:justify? false}}" -f src
(ns fmt-test.core)
(def will-print-out
{:key1
{:a {:b ["testaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]}},
:key2 "hello"})
(def will-also-print-out
{:key1
{:a {:b ["testaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]}}})
(def will-disappear
{:key1
{:a {:b ["testaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]}},
:key2 "hello"})
true
:➜ fmt-test boot -d boot-fmt fmt --options "{:map {:justify? true}}" -f src
(ns fmt-test.core)
(def will-print-out
{:key1 {:a
{:b
["testaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]}},
:key2 "hello"})
(def will-also-print-out
{:key1
{:a {:b ["testaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]}}})
In many cases boot-fmt should be able to figure out the paths of source files itself:
:source-path
and :resource-path
git ls-files '*.clj' '*.cljs' '*.cljc' '*.boot' '*.edn'
lein-zprint supports shebang options (https://github.com/kkinnear/lein-zprint#configuring-lein-zprint-in-your-source-file)
This should work with boot-fmt too. Add documentation for this feature (and link to lein-zprint's).
As in lein-zprint
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.