Replies: 3 comments 2 replies
-
Aron,
While I think I can do exactly what you want, I can't get to it until tomorrow.
If you put this into your .zprintrc (or somewhere), and use this new style,
it will do most of what you want. You can't define the style and use it
in the same zprintrc, unfortunately.
{:style-map {:m2 {:fn-map {"app"
[:force-nl-body
{:list {:constant-pair-min 1,
:constant-pair-fn #(or (keyword? %)
(string? %)
(number? %)
(= true %)
(= false %)
(vector? %))},
:pair {:justify? true},
:next-inner {:list {:constant-pair-min 4,
:constant-pair-fn nil},
:pair {:justify? false}}}]}}}}
More later...
… On Dec 10, 2020, at 1:28 PM, Aron Griffis ***@***.***> wrote:
I love zprint and I believe its configuration is very powerful, and yet I still struggle with flows, hangs and wrapping...
I am using this incantation from #56 (comment)
{:fn-map {"app" [:none {:style [:moustache :justified]}]}}
I would like output like this:
(def handler
(
m/app
[
"api"
&] query-app
[
"path-api" &] query-app))
but I get this instead:
(def handler (m/app ["api" &] query-app ["path-api" &] query-app))
I wouldn't mind this:
(def handler (m/app ["api"
&] query-app
[
"path-api" &] query-app))
or this:
(def handler
(
m/app ["api"
&] query-app
[
"path-api" &] query-app))
I just don't want it to put two pairs on one line, even if it would fit.
Generally I really like the fact that zprint will fit things if it can, but there are occasions when I'd rather see a linebreak, even if it would fit. This is one of those occasions...
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
-
Thanks for finding the discussions! I am making changes in 1.1.0 that will make it very straightforward to get what you want. In particular, you will be able to use functions in options maps in an For now, in 1.0.2, there are two answers -- one for the distributed binaries, and one for using If you use the distributed graalVM binaries, here is the best I can do for you in 1.0.2. This is a real hack and doesn't fully give you what you want, but it will help a least a bit. ; Put this in your ~/.zprintrc
{:fn-force-nl #{:none} :style :moustache}
; Then you will get
$ ./zprintm-1.0.2 <hand.clj
(def handler
(m/app ["api" &] query-app
["path-api" &] query-app))
$ ./zprintm-1.0.2 <mapp9.clj
(m/app :get (m/app middle1
middle2
middle3
[route] handler
[longer route]
(handler this is "a" test "this" is "only a" test))
; How do comments work here?
true (should be paired with true)
false (should be paired with false)
6 (should be paired with 6)
"string" (should be paired with string)
:post (m/app [a really long route] handler
[route] handler)) This wasn't justified, I know. If you want them justified, then you have to put up with all pairs being justified. That is mostly ; Put this in your ~/.zprintrc`
{:fn-force-nl #{:none} :style :moustache :pair {:justify? true}}
$ ./zprintm-1.0.2 <hand.clj
(def handler
(m/app ["api" &] query-app
["path-api" &] query-app))
$ ./zprintm-1.0.2 <mapp9.clj
(m/app :get (m/app middle1
middle2
middle3
[route] handler
[longer route]
(handler this is "a" test "this" is "only a" test))
; How do comments work here?
true (should be paired with true)
false (should be paired with false)
6 (should be paired with 6)
"string" (should be paired with string)
:post (m/app [a really long route] handler
[route] handler)) If, instead, you are using
In 1.1.0, the above will work for the distributed graalVM binaries as well. At present, there is no way to get "m/app" to put the next things on the next line and have constant pairing work. I will be changing that in 1.1.0 because of this conversation, so I'm glad you brought this up. Thus, in 1.1.0, the One further note. I think that I might have erred in defining the I think that I will keep a style which does what I think you want, called I'm still pondering how to have someone tweak a style by changing the style map and then invoke that tweaked style in the same Anyway, I hope this help. What will really help will be the changes I'm making in 1.1.0. Oh, thanks also for mentioning in Issue #56 that zprint ignored your options maps with issues without visible complaint. Turns out that options maps found with Let me know how this goes if you can. |
Beta Was this translation helpful? Give feedback.
-
I released 1.1.0 yesterday. The
I did also make it possible to define a Overall, I think it will just work for you, but if it doesn't, there certainly are multiple ways of adjusting what is there without requiring a new release to make it better. Thanks for pursuing this, it encouraged me to take on a lot of cleanup that I wouldn't otherwise have been motivated to accomplish! |
Beta Was this translation helpful? Give feedback.
-
I love zprint and I believe its configuration is very powerful, and yet I still struggle with flows, hangs and wrapping...
I am using this incantation from #56 (comment)
I would like output like this:
but I get this instead:
I wouldn't mind this:
or this:
I just don't want it to put two pairs on one line, even if it would fit.
Generally I really like the fact that zprint will fit things if it can, but there are occasions when I'd rather see a linebreak, even if it would fit. This is one of those occasions...
Beta Was this translation helpful? Give feedback.
All reactions