You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/reference/clojure_cli.adoc
+67-34Lines changed: 67 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -15,27 +15,70 @@ The Clojure CLI is a command-line tool to run Clojure programs on the Java Virtu
15
15
16
16
== Installation
17
17
18
-
The Clojure CLI can be installed via Homebrew, bash/posix script, or Powershell depending on the platform. See the <<xref/../../../guides/install_clojure#,installation guide>> for details and the <<xref/../../../releases/tools#,release page>> for version information. You can also read the <<xref/../../../guides/deps_and_cli#,guide>> for a longer tutorial.
18
+
The Clojure CLI can be installed via Homebrew, bash/posix script, or Powershell depending on the platform. See the <<xref/../../../guides/install_clojure#,installation guide>> for details and the <<xref/../../../releases/tools#,release page>> for version information. You can also read the <<xref/../../../guides/deps_and_cli#,guide>> for a longer tutorial. For artifact building, check out the <<xref/../../../guides/tools_build#,tools.build guide>>.
19
19
20
20
Any version of the Clojure CLI can use any version of the Clojure language. Generally it is best to use the latest <<xref/../../../releases/tools#,version of the CLI>> to have the latest features and fixes. Given a CLI version A.B.C[.D], the default <<xref/../../../releases/downloads#,version of Clojure>> used at the REPL will be A.B.C, however you can specify an older (or newer!) version of the language in your dependencies.
21
21
22
22
[[usage]]
23
23
== Usage
24
24
25
-
The CLI is invoked via either `clojure` or `clj`. In general, you can treat these interchangeably, but `clj` includes `rlwrap` for extended keyboard editing, of particular use for the REPL. Because `clj` is fewer characters to type, it is most commonly used but this reference will use `clj` for REPL examples and `clojure` for non-REPL examples.
25
+
The CLI is invoked via either `clojure` or `clj`. In general, you can treat these interchangeably but `clj` includes `rlwrap` for extended keyboard editing, particularly useful with the REPL. This reference uses `clj` for REPL examples and `clojure` for non-REPL examples.
26
+
27
+
Each execution of the Clojure CLI runs a Clojure program by determining all paths, dependencies, and main entry point, then invoking the program on the JVM. The primary kind of execution is determined by `-X`, `-T`, and `-M` (or their absence). Configuration is defined by one or more <<deps_edn,deps.edn>> files in combination with the <<clojure_cli#opt_index,command-line options>>.
28
+
29
+
[[commands]]
30
+
=== Primary commands
31
+
32
+
<<clojure_cli#use_repl,Start a REPL:>> +
33
+
`clj [clj-opts] [-Aaliases]`
34
+
35
+
<<clojure_clj#use_fn,Execute a function:>> +
36
+
`clojure [clj-opts] -X[aliases] my/fn? [kpath v ...] kv-map?`
37
+
38
+
<<clojure_clj#use_tool,Run a tool:>> +
39
+
`clojure [clj-opts] -T[name|aliases] my/fn [kpath v ...] kv-map?`
40
+
41
+
<<clojure_clj#use_main,Run a main namespace or script:>> +
See the <<clojure_cli#opt_index,option index>> for a complete list of CLI options.
49
+
exec-opts:
50
+
<<clojure_cli#opt_a,-Aaliases>> Use aliases, particularly for repl execution
51
+
<<clojure_cli#opt_x,-X[aliases]>> Invoke function, using aliases
52
+
<<clojure_cli#opt_t,-Ttoolname>> Invoke tool by local name
53
+
<<clojure_cli#opt_t,-T[aliases]>> Invoke tool by concatenated aliases (ala -X)
54
+
<<clojure_cli#opt_m,-M[aliases]>> Invoke clojure.main, using aliases
55
+
<<clojure_cli#opt_p,-P>> Prepare deps but don't exec
56
+
57
+
clj-opts:
58
+
<<clojure_cli#opt_j,-Jopt>> Pass opt through in java_opts, ex: -J-Xmx512m
59
+
<<clojure_cli#opt_sdeps,-Sdeps EDN>> Extra deps.edn data
60
+
<<clojure_cli#opt_srepro,-Srepro>> Ignore user deps.edn file
61
+
<<clojure_cli#opt_spath,-Spath>> Compute classpath, echo to stdout
62
+
<<clojure_cli#opt_stree,-Stree>> Print dependency tree
63
+
<<clojure_cli#opt_scp,-Scp CP>> Use this classpath instead of computing
64
+
<<clojure_cli#opt_sforce,-Sforce>> Force recomputation of the classpath
65
+
<<clojure_cli#opt_sverbose,-Sverbose>> Print important path info to console
66
+
<<clojure_cli#opt_sdescribe,-Sdescribe>> Print environment and command parsing info as data
67
+
<<clojure_cli#opt_sthreads,-Sthreads>> Set specific number of download threads
68
+
<<clojure_cli#opt_strace,-Strace>> Write a trace.edn file that traces deps expansion
69
+
<<clojure_cli#opt_sversion,--version>> Print the version to stdout and exit
70
+
<<clojure_cli#opt_sversion,-version>> Print the version to stderr and exit
71
+
<<clojure_cli#opt_help,--help -h -?>> Print this help message and exit
72
+
73
+
Programs provided by :deps alias:
74
+
<<clojure_cli#deps_list,-X:deps list>> List transitive deps + licenses
75
+
<<clojure_cli#deps_tree,-X:deps tree>> Print deps tree
76
+
<<clojure_cli#deps_find_versions,-X:deps find-versions>> Find available versions of library
77
+
<<clojure_cli#deps_prep,-X:deps prep>> Prepare all unprepped libs in dep tree
78
+
<<clojure_cli#deps_mvn_pom,-X:deps mvn-pom>> Generate pom.xml for deps.edn
79
+
<<clojure_cli#deps_mvn_install,-X:deps mvn-install>> Install maven jar to local repo
35
80
----
36
81
37
-
Each execution of the Clojure CLI runs a Clojure program by determining all paths, dependencies, and main entry point, then invoking the program on the JVM. The primary kind of execution is determined by `-X`, `-T`, and `-M` (or their absence), described further below. Configuration is defined by one or more <<deps_edn,deps.edn>> files in combination with the command-line options.
0 commit comments