Logo

0x3d.Site

is designed for aggregating information.
Welcome
check repository here

Clojars CI cljdoc badge

Sometimes, neatness counts

If you are trying to puzzle out a stack trace, pick a critical line of text out of a long stream of console output, or compare two streams of binary data, a little bit of formatting can go a long way.

That's what org.clj-commons/pretty is for. It adds support for pretty output where it counts:

  • Readable output for exceptions
  • General ANSI font and background color support
  • Readable output for binary sequences

Example

Pretty can print out a sequence of bytes; it includes color-coding inspired by hexyl:

Binary Output

Pretty can also print out a delta of two byte sequences, using background color to indicate where the two sequences differ.

Binary Delta

Pretty can output pretty tabular data:

(print-table
    [:method
     :path
     {:key :route-name :title "Name"}]
    [{:method     :get
      :path       "/"
      :route-name :root-page}
     {:method     :post
      :path       "/reset"
      :route-name :reset}
     {:method     :get
      :path       "/status"
      :route-name :status}])
┏━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Method ┃   Path  ┃    Name    ┃
┣━━━━━━━━╋━━━━━━━━━╋━━━━━━━━━━━━┫
┃   :get ┃       / ┃ :root-page ┃
┃  :post ┃  /reset ┃ :reset     ┃
┃   :get ┃ /status ┃ :status    ┃
┗━━━━━━━━┻━━━━━━━━━┻━━━━━━━━━━━━┛
=> nil

The print-table function has many options to easily adjust the output to your needs, including fonts, text alignment, and the table border.

Compatibility

Pretty is compatible with Clojure 1.10 and above.

Parts of Pretty can be used with Babashka, such as the clj-commons.ansi namespace; however, Babashka runs in an interpreter and its approach to exceptions is incompatible with JVM exceptions.

License

The majority of this code is available under the terms of the Apache Software License 1.0; some portions are available under the terms of the Eclipse Public Licence 1.0.

Clojure
Clojure
Clojure is a modern, functional programming language that runs on the JVM. It emphasizes immutability and concurrency, making it suitable for scalable applications. Its simplicity and powerful abstractions attract developers in data science and backend development.
Biff | Clojure web framework
Biff | Clojure web framework
Kamalavelan / column · GitLab
Kamalavelan / column · GitLab
Clojure Tutorials
Clojure Tutorials
reborg
reborg
Misophistful
Misophistful
ClojureVids
ClojureVids
GitHub - venantius/photon: Experiments in realtime web framework design. Like Meteor, but for Clojure(Script)
GitHub - venantius/photon: Experiments in realtime web framework design. Like Meteor, but for Clojure(Script)
GitHub - fhd/clostache: {{ mustache }} for Clojure
GitHub - fhd/clostache: {{ mustache }} for Clojure
GitHub - dakrone/cheshire: Clojure JSON and JSON SMILE (binary json format) encoding/decoding
GitHub - dakrone/cheshire: Clojure JSON and JSON SMILE (binary json format) encoding/decoding
GitHub - mrdimosthenis/clj-synapses: A neural networks library for Clojure
GitHub - mrdimosthenis/clj-synapses: A neural networks library for Clojure
GitHub - plumatic/schema: Clojure(Script) library for declarative data description and validation
GitHub - plumatic/schema: Clojure(Script) library for declarative data description and validation
GitHub - http-kit/http-kit: Simple, high-performance event-driven HTTP client+server for Clojure
GitHub - http-kit/http-kit: Simple, high-performance event-driven HTTP client+server for Clojure
GitHub - pedestal/pedestal: The Pedestal Server-side Libraries
GitHub - pedestal/pedestal: The Pedestal Server-side Libraries
GitHub - ztellman/proteus: local. mutable. variables.
GitHub - ztellman/proteus: local. mutable. variables.
GitHub - fulcrologic/fulcro: A library for development of single-page full-stack web applications in clj/cljs
GitHub - fulcrologic/fulcro: A library for development of single-page full-stack web applications in clj/cljs
GitHub - tpope/vim-fireplace: fireplace.vim: Clojure REPL support
GitHub - tpope/vim-fireplace: fireplace.vim: Clojure REPL support
Home
Home
GitHub - clojure-cookbook/clojure-cookbook: This is the home of O'Reilly's Clojure Cookbook - http://clojure-cookbook.com
GitHub - clojure-cookbook/clojure-cookbook: This is the home of O'Reilly's Clojure Cookbook - http://clojure-cookbook.com
GitHub - ertugrulcetin/re-frame-flow: Graph based visualization tool for re-frame event chains
GitHub - ertugrulcetin/re-frame-flow: Graph based visualization tool for re-frame event chains
Build software better, together
Build software better, together
Daniel Amber
Daniel Amber
Build software better, together
Build software better, together
GitHub - technomancy/leiningen: Moved to Codeberg; this is a convenience mirror
GitHub - technomancy/leiningen: Moved to Codeberg; this is a convenience mirror
Build software better, together
Build software better, together
Build software better, together
Build software better, together
GitHub - darkleaf/di: DI is a dependency injection framework that allows you to define dependencies as cheaply as defining function arguments.
GitHub - darkleaf/di: DI is a dependency injection framework that allows you to define dependencies as cheaply as defining function arguments.
Build software better, together
Build software better, together
GitHub - junegunn/rainbow_parentheses.vim: :rainbow: Simpler Rainbow Parentheses
GitHub - junegunn/rainbow_parentheses.vim: :rainbow: Simpler Rainbow Parentheses
GitHub - clojure/core.match: An optimized pattern matching library for Clojure
GitHub - clojure/core.match: An optimized pattern matching library for Clojure
GitHub - yogthos/clojure-error-message-catalog: a catalog of common Clojure errors and their meaning
GitHub - yogthos/clojure-error-message-catalog: a catalog of common Clojure errors and their meaning
Clojure
More on Clojure

  1. Programming Tips & Tricks
  2. Error Solutions
  3. Shortcuts
  4. Collections

Tools

available to use.

Made with ❤️

to provide resources in various ares.