Giter VIP home page Giter VIP logo

boot-fmt's People

Contributors

grzm avatar kennyjwilli avatar martinklepsch avatar pesterhazy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

boot-fmt's Issues

Improve readme

  • boot newbie instructions links (installation etc.)
  • quick start
  • motivation

adds extra newlines between comment lines on output

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.

  1. Let me know that you want to use 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.
  2. You can just copy 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).

be nice to have all modes show up in the --help output

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.

Make zprint version configurable

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.

Using {:map {:justify? true}} option causes nested maps with long strings to disappear

Here's a minimal test case I could find:

Positive case with justify false:

➜  fmt-test boot -d boot-fmt fmt --options "{:map {:justify? false}}" -f src

Output:

(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"})

And failing case with justify true:

➜  fmt-test boot -d boot-fmt fmt --options "{:map {:justify? true}}" -f src

Output:

(ns fmt-test.core)

(def will-print-out
  {:key1 {:a
            {:b
               ["testaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]}},
   :key2 "hello"})

(def will-also-print-out
  {:key1
     {:a {:b ["testaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]}}})

Auto-detect src files

In many cases boot-fmt should be able to figure out the paths of source files itself:

  • from the :source-path and :resource-path
  • using git ls-files '*.clj' '*.cljs' '*.cljc' '*.boot' '*.edn'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.