Skip to content

Instantly share code, notes, and snippets.

@mtnygard

mtnygard/deps.edn

Forked from athos/deps.edn
Last active May 27, 2020
Embed
What would you like to do?
Friendly REPL. Run with `clojure -Sdeps '{:deps {hello-clojure {:git/url "https://gist.github.com/mtnygard/9b2dd3c88b3309d82210b84f33ee954d" :sha "774314af2d28261af4a52ac270136d5ba21ff046"}}}' -m frenpl`
{:paths ["." "src" "test"]
:deps {expound {:mvn/version "0.8.4"}
clansi {:mvn/version "1.0.0"}
cider/cider-nrepl {:mvn/version "0.24.0"}
refactor-nrepl {:mvn/version "2.5.0"}
com.bhauman/rebel-readline {:mvn/version "0.1.4"}}}
(ns frenpl
"The user-friendly REPL"
(:require clansi
[clojure.java.io :as io]
[expound.alpha :as expound]
[clojure.spec.alpha :as s]
[nrepl.server :as nrepl-server]
[cider.nrepl :refer (cider-nrepl-handler)]
[refactor-nrepl.middleware :as refactor]
[rebel-readline.main]))
(def styles
{\b :bg-blue
\g :bg-green
\w :bg-white})
(defn colorize-line [line]
(->> line
(map #(clansi/style " " (get styles % :bg-default)))
(apply str)))
(defn -main [& args]
(with-open [r (io/reader (io/resource "logo.dat"))]
(run! #(println (colorize-line %)) (line-seq r)))
(set! s/*explain-out* (expound/custom-printer {:print-specs? false :show-valid-values? true}))
(spit ".nrepl-port" "7888\n")
(nrepl-server/start-server :port 7888 :handler (refactor/wrap-refactor cider-nrepl-handler))
(println "\n\nNREPL server started on port 7888\n\n")
(apply rebel-readline.main/-main args))
-----------wwwwwwwwww-----------
---------wwwwwbbbbwwwww---------
-------wwwbbbbbbbbbbbwwww-------
------wwbbbbbbbbbbbbbbbwww------
-----wwbbbbbbbbbbbbbbbbbbww-----
----wwbbbbbbbbbbbbbbbbbbbbww----
---wwwwwwwwbbbbbbbbbbbbbbbbww---
--wwwwwwwwwwwwwwwwwbbbbbbbbbww--
--wwwwgggwwwwwbbbbwwwbbbbbbbww--
-wwwwggggwwgwwbbbbbbwwbbbbbbbww-
-wwwgggggwwggwwbbbbbbwwbbbbbbww-
wwwgggggwwgggwwbbbbbbbwwbbbbbbw-
wwgggggwwgggggwwbbbbbbbwbbbbbbww
wwgggggwwgggggwwbbbbbbbwwbbbbbww
wggggggwgggggggwbbbbbbbwwbbbbbww
wggggggwgggggggwbbbbbbbbwbbbbbww
wggggggwggggggwwwbbbbbbbwbbbbbww
wggggggwgggggwwgwbbbbbbwwbbbbbww
wwgggggwwggggwggwwbbbbbwwbbbbbww
wwggggggwgggwwggwwbbbbbwbbbbbbw-
-wggggggwwggwggggwwbbbwwbbbbbww-
-wgggggggwwgwggggwwbbwwbbbbbwww-
-wwgggggggwwwgggggwwwwbbbbwwww--
--wwgggggggwwwwggwwwwwwwwwwwww--
--wwgggggggggwwwwwwgggwwwwggw---
---wwggggggggggggggggggggggww---
----wwggggggggggggggggggggww----
-----wwggggggggggggggggggww-----
------wwwggggggggggggggwww------
--------wwwggggggggggwww--------
----------wwwwwwwwwwww----------
-------------wwwwww-------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment