diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b66671a..7f73b686 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ For a list of breaking changes, check [here](#breaking-changes). A preview of the next release can be installed from [babashka-dev-builds](https://github.com/babashka/babashka-dev-builds). +## Unreleased + +- Convey `*print-length*` to pprint and allow `set!` + ## 0.8.1 (2022-04-15) - Add `prepare` subcommand to download deps & pods and cache pod metadata diff --git a/src/babashka/impl/pprint.clj b/src/babashka/impl/pprint.clj index 8047638b..bbc8df71 100644 --- a/src/babashka/impl/pprint.clj +++ b/src/babashka/impl/pprint.clj @@ -95,7 +95,8 @@ pprint/*print-pprint-dispatch* @print-pprint-dispatch pprint/*print-miser-width* @print-miser-width *print-meta* @sci/print-meta - *print-readably* @sci/print-readably] + *print-readably* @sci/print-readably + *print-length* @sci/print-length] (pprint/pprint s writer)))) (defn cl-format diff --git a/src/babashka/main.clj b/src/babashka/main.clj index 7d68aff6..add257f6 100644 --- a/src/babashka/main.clj +++ b/src/babashka/main.clj @@ -711,7 +711,8 @@ Use bb run --help to show this help output. (sci/binding [core/warn-on-reflection @core/warn-on-reflection core/unchecked-math @core/unchecked-math core/data-readers @core/data-readers - sci/ns @sci/ns] + sci/ns @sci/ns + sci/print-length @sci/print-length] (let [{version-opt :version :keys [:shell-in :edn-in :shell-out :edn-out :help :file :command-line-args diff --git a/test/babashka/pprint_test.clj b/test/babashka/pprint_test.clj new file mode 100644 index 00000000..4679db46 --- /dev/null +++ b/test/babashka/pprint_test.clj @@ -0,0 +1,12 @@ +(ns babashka.pprint-test + (:require + [babashka.test-utils :as test-utils] + [clojure.string :as str] + [clojure.test :as test :refer [deftest is]])) + +(defn bb [& args] + (str/trim (apply test-utils/bb (map str args)))) + +(deftest print-length-test + (is (= "(0 1 2 3 4 5 6 7 8 9 ...)" + (bb "-e" "(set! *print-length* 10) (clojure.pprint/pprint (range 20))"))))