From d47a05cc0f0db6f64469ba3b3bc0680c4326df15 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 3 Jan 2024 14:31:04 -0600 Subject: [PATCH] create option index --- content/reference/clojure_cli.adoc | 101 +++++++++++++++++++---------- 1 file changed, 67 insertions(+), 34 deletions(-) diff --git a/content/reference/clojure_cli.adoc b/content/reference/clojure_cli.adoc index dfbc6051..e78e3539 100644 --- a/content/reference/clojure_cli.adoc +++ b/content/reference/clojure_cli.adoc @@ -15,27 +15,70 @@ The Clojure CLI is a command-line tool to run Clojure programs on the Java Virtu == Installation -The Clojure CLI can be installed via Homebrew, bash/posix script, or Powershell depending on the platform. See the <> for details and the <> for version information. You can also read the <> for a longer tutorial. +The Clojure CLI can be installed via Homebrew, bash/posix script, or Powershell depending on the platform. See the <> for details and the <> for version information. You can also read the <> for a longer tutorial. For artifact building, check out the <>. Any version of the Clojure CLI can use any version of the Clojure language. Generally it is best to use the latest <> to have the latest features and fixes. Given a CLI version A.B.C[.D], the default <> used at the REPL will be A.B.C, however you can specify an older (or newer!) version of the language in your dependencies. [[usage]] == Usage -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. +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. + +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 <> files in combination with the <>. + +[[commands]] +=== Primary commands + +<> + +`clj [clj-opts] [-Aaliases]` + +<> + +`clojure [clj-opts] -X[aliases] my/fn? [kpath v ...] kv-map?` + +<> + +`clojure [clj-opts] -T[name|aliases] my/fn [kpath v ...] kv-map?` + +<> + +`clojure [clj-opts] -M[aliases] [init-opts] [main-opts] [args]` + +[[options]] +=== Option index: [subs=+macros] ---- -<> -<> -<> -<> - -See the <> for a complete list of CLI options. +exec-opts: + <> Use aliases, particularly for repl execution + <> Invoke function, using aliases + <> Invoke tool by local name + <> Invoke tool by concatenated aliases (ala -X) + <> Invoke clojure.main, using aliases + <> Prepare deps but don't exec + +clj-opts: + <> Pass opt through in java_opts, ex: -J-Xmx512m + <> Extra deps.edn data + <> Ignore user deps.edn file + <> Compute classpath, echo to stdout + <> Print dependency tree + <> Use this classpath instead of computing + <> Force recomputation of the classpath + <> Print important path info to console + <> Print environment and command parsing info as data + <> Set specific number of download threads + <> Write a trace.edn file that traces deps expansion + <> Print the version to stdout and exit + <> Print the version to stderr and exit + <> Print this help message and exit + +Programs provided by :deps alias: + <> List transitive deps + licenses + <> Print deps tree + <> Find available versions of library + <> Prepare all unprepped libs in dep tree + <> Generate pom.xml for deps.edn + <> Install maven jar to local repo ---- -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 <> files in combination with the command-line options. - [[use_repl]] === Start a REPL @@ -157,6 +200,20 @@ clojure [clj-opt*] -M[aliases] [main-opts] The -M aliases are pulled from `deps.edn` and combined to form an arg map. The arg map can modify the classpath or supply main options. +[subs=+macros] +---- +__init-opts: (use with -M only)__ + -i, --init path Load a file or resource + -e, --eval string Eval exprs in string; print non-nil values + --report target Report uncaught exception to "file" (default), "stderr", or "none" + +__main-opts:__ + -m, --main ns-name Call the -main function from namespace w/args + -r, --repl Run a repl + path Run a script from a file or resource + - Run a script from standard input +---- + See the <> documentation for more details on main options. [[aliases]] @@ -252,30 +309,6 @@ PS D:> clj -X clojure.core/prn :val '{:s1 """nospaces""" :s2 ""has spaces""}' {:val {:s1 "nospaces", :s2 "has spaces"}} ---- -[[opt_index]] -== Option index - - opt_A - opt_X - opt_T - opt_M - opt_fn - opt_kvs - opt_main_init - opt_main_opt - opt_help - opt_version - opt_J - opt_sdeps - opt_spath - opt_stree - opt_scp - opt_srepro - opt_sforce - opt_strace - opt_sthreads - opt_sverbose - [[procurers]] = Procurers