snippetbashTip
clj — Clojure tool to start a REPL or invoke a function with data. All options can be defined in a `deps.e
Viewed 0 times
commandstartinvokeclitoolclojurereplclj
Problem
How to use the
clj command: Clojure tool to start a REPL or invoke a function with data. All options can be defined in a deps.edn file. More information: <https://clojure.org/guides/deps_and_cli>.Solution
clj — Clojure tool to start a REPL or invoke a function with data. All options can be defined in a deps.edn file. More information: <https://clojure.org/guides/deps_and_cli>.Start a REPL (interactive shell):
cljExecute a function:
clj -X {{namespace/function_name}}Run the main function of a specified namespace:
clj -M {{[-m|--main]}} {{namespace}} {{args}}Prepare a project by resolving dependencies, downloading libraries, and making/caching classpaths:
clj -PStart an nREPL server with the CIDER middleware:
clj -Sdeps '{:deps {nrepl {:mvn/version "0.7.0"} cider/cider-nrepl {:mvn/version "0.25.2"}}}' {{[-m|--main]}} nrepl.cmdline --middleware '["cider.nrepl/cider-middleware"]' --interactiveStart a REPL for ClojureScript and open a web browser:
clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.758"}}}' {{[-m|--main]}} cljs.main {{[-r|--repl]}}Code Snippets
Start a REPL (interactive shell)
cljExecute a function
clj -X {{namespace/function_name}}Run the main function of a specified namespace
clj -M {{[-m|--main]}} {{namespace}} {{args}}Prepare a project by resolving dependencies, downloading libraries, and making/caching classpaths
clj -PStart an nREPL server with the CIDER middleware
clj -Sdeps '{:deps {nrepl {:mvn/version "0.7.0"} cider/cider-nrepl {:mvn/version "0.25.2"}}}' {{[-m|--main]}} nrepl.cmdline --middleware '["cider.nrepl/cider-middleware"]' --interactiveContext
tldr-pages: common/clj
Revisions (0)
No revisions yet.