Skip to content

Commit

Permalink
Upgrade to fipp 0.4.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
greglook committed May 20, 2014
1 parent 547bebf commit f3add97
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:dependencies
[[org.clojure/clojure "1.6.0"]
[org.clojure/data.codec "0.1.0"]
[fipp "0.4.1"]]
[fipp "0.4.2"]]

:profiles
{:coverage
Expand Down
26 changes: 14 additions & 12 deletions src/puget/printer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Functions for canonical colored printing of EDN values."
(:require
[clojure.string :as str]
[fipp.printer :refer [defprinter]]
[fipp.printer :as fipp]
(puget
[ansi :as ansi]
[data :as data])))
Expand Down Expand Up @@ -214,16 +214,22 @@

;; PRINT FUNCTIONS

(defprinter pprint canonize {:width 80})
(def ^:private default-opts
"Default Puget printing options."
{:width 80})


(defn pprint
([value]
(pprint value default-opts))
([value opts]
(fipp/pprint-document (canonize value) opts)))


(defn pprint-str
"Pretty-print a value to a string."
([value]
(-> value
pprint
with-out-str
str/trim-newline))
(pprint-str value default-opts))
([value opts]
(-> value
(pprint opts)
Expand All @@ -234,8 +240,7 @@
(defn cprint
"Like pprint, but turns on colored output."
([value]
(binding [*colored-output* true]
(pprint value)))
(cprint value default-opts))
([value opts]
(binding [*colored-output* true]
(pprint value opts))))
Expand All @@ -244,10 +249,7 @@
(defn cprint-str
"Pretty-prints a value to a colored string."
([value]
(-> value
cprint
with-out-str
str/trim-newline))
(cprint-str value default-opts))
([value opts]
(-> value
(cprint opts)
Expand Down

0 comments on commit f3add97

Please sign in to comment.