-
-
Save mtnygard/9b2dd3c88b3309d82210b84f33ee954d to your computer and use it in GitHub Desktop.
Friendly REPL. Run with `clojure -Sdeps '{:deps {hello-clojure {:git/url "https://gist.github.com/mtnygard/9b2dd3c88b3309d82210b84f33ee954d" :sha "774314af2d28261af4a52ac270136d5ba21ff046"}}}' -m frenpl`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{: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"}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-----------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
Thanks for creating this gist! FYI that running this command locally emits a warning under Clojure v1.11.1.1429: