Skip to content

Commit 178cace

Browse files
committed
wip
1 parent 39233d2 commit 178cace

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

content/reference/clojure_cli.adoc

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,29 +46,45 @@ Use this option to start a Clojure REPL.
4646
clj [clj-opts] [-Aaliases]
4747
----
4848

49-
To run a REPL, invoke `clj` without arguments:
49+
To run a REPL, invoke `clj` without arguments.
50+
51+
This works in any directory, either with a deps.edn or not. If you are not in a <<clojure_cli#project_dir,project directory>>, the version of Clojure used will depend on the Clojure language version from the org.clojure dependency in the root deps.edn (will match the version number in CLI version number) or the user deps.edn in the <<clojure_cli#config_dir,config directory>> (usually not specified).
52+
53+
To supply <<clojure_cli#aliases,aliases>> that modify the <<clojure_cli#classpath,classpath>> or <<clojure_cli#jvm_props#,JVM properties>>, use `-A` with one or more concatenated alias keywords:
5054

5155
[source]
5256
----
53-
$ clj
54-
Clojure 1.11.1
55-
user=>
56-
----
57-
58-
If you wish to include <<clojure_cli#aliases,aliases>> that affect the
57+
clj -A:test
5958
59+
clj -A:test:dev
60+
----
6061

6162
[[use_fn]]
6263
=== Execute a function (-X)
6364

64-
Use the following exec-opt to invoke a function that takes a map:
65+
The Clojure CLI can execute any function on the classpath that takes keyword args in a map as input.
6566

6667
[source]
6768
----
6869
clojure [clj-opt*] -X[aliases] [a/fn] [kpath v]* kv-map?
6970
----
7071

71-
`-X` is configured with an arg map with `:exec-fn` and `:exec-args` keys, and stored under an alias in `deps.edn`:
72+
Function execution ultimately needs the following pieces of information:
73+
74+
* Classpath
75+
* Qualified function to execute
76+
* Map of key to value
77+
78+
79+
80+
`-X` <<clojure_cli#aliases,aliases>> can contain the following arg map keys:
81+
82+
* `:exec-fn` - a function symbol to use when none is supplied on the command line
83+
* `:exec-args` - a map of key to value to include when `exec-fn` is executed, may be superseded by keyword args on the command line (so these act as defaults)
84+
* `:ns-default` - default namespace symbol to use when interpreting the exec-fn
85+
* `:ns-aliases` - map of alias symbol to namespace symbol to use when interpreting the exec-fn
86+
87+
7288

7389
[source,clojure]
7490
----

0 commit comments

Comments
 (0)