clj
The clj
command line tool is used to interact with Clojure projects from the command line. It is part of the Clojure language and provides a variety of useful features for working with Clojure code.
Here are some key features and functionalities of clj
:
-
REPL (Read-Eval-Print-Loop): The
clj
tool allows you to start a Clojure REPL directly from the command line. REPL is an interactive environment where you can evaluate and experiment with snippets of Clojure code. -
Running scripts: You can use
clj
to run Clojure scripts (.clj files) directly from the command line. This allows you to execute standalone Clojure programs without needing to compile them into Java bytecode. -
Project management:
clj
provides project management capabilities through the use ofdeps.edn
files. You can useclj
to manage project dependencies, run tests, build artifacts, and more. -
Dependency management: With
clj
, you can specify dependencies for your Clojure projects.clj
will automatically download and manage the required libraries, making it easy to include external libraries in your projects. -
Integration with build tools:
clj
integrates well with popular build tools like Leiningen and Boot. It can be used in conjunction with these tools to build, test, and package Clojure projects. -
Code formatting and linting:
clj
provides tools for formatting and linting Clojure code. It helps enforce consistent coding styles and identifies potential issues or mistakes in your code.
Overall, the clj
command line tool is a powerful and versatile tool for working with Clojure projects, providing a range of features for development, testing, and project management.
List of commands for clj:
-
clj:tldr:2198b clj: Start a REPL (interactive shell).$ cljtry on your machineexplain this command
-
clj:tldr:4907b clj: Run the main function of a specified namespace.$ clj -M -m ${namespace} ${args}try on your machineexplain this command
-
clj:tldr:5915f clj: Start 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 nrepl.cmdline --middleware '["cider.nrepl/cider-middleware"]' --interactivetry on your machineexplain this command
-
clj:tldr:5afe1 clj: Execute a function.$ clj -X ${namespace-function_name}try on your machineexplain this command
-
clj:tldr:a1b44 clj: Prepare a project by resolving dependencies, downloading libraries, and making / caching classpaths.$ clj -Ptry on your machineexplain this command
-
clj:tldr:e6b2a clj: Start a REPL for ClojureScript and open a web browser.$ clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.758"}}}' --main cljs.main --repltry on your machineexplain this command