Skip to content

Instantly share code, notes, and snippets.

@phronmophobic
Last active March 11, 2021 18:54
Show Gist options
  • Select an option

  • Save phronmophobic/97ea46dfae51958e2e7686243ac27860 to your computer and use it in GitHub Desktop.

Select an option

Save phronmophobic/97ea46dfae51958e2e7686243ac27860 to your computer and use it in GitHub Desktop.
Reorganized clojure cli help
Usage:
Start a REPL clj [clj-opt*] [-A:aliases] [init-opt*]
Exec function clojure [clj-opt*] -X[:aliases] [a/fn] [kpath v]*
Run main clojure [clj-opt*] -M[:aliases] [init-opt*] [main-opt] [arg*]
Prepare clojure [clj-opt*] -P [other exec opts]
clj-opts:
-Jopt Pass opt through in java_opts, ex: -J-Xmx512m
-Sdeps EDN Deps data to use as the last deps file to be merged
-Spath Compute classpath and echo to stdout only
-Spom Generate (or update) pom.xml with deps and paths
-Stree Print dependency tree
-Scp CP Do NOT compute or cache classpath, use this one instead
-Srepro Ignore the ~/.clojure/deps.edn config file
-Sforce Force recomputation of the classpath (don't use the cache)
-Sverbose Print important path info to console
-Sdescribe Print environment and command parsing info as data
-Sthreads Set specific number of download threads
-Strace Write a trace.edn file that traces deps expansion
-- Stop parsing dep options and pass remaining arguments to clojure.main
-A:[aliases]
Start a REPL
Use aliases to modify classpath
clojure [clj-opt*] [-A:aliases] [init-opt*]
init-opt:
-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"
-X[:aliases]
Exec function
Use aliases to modify classpath or supply exec fn/args
clj [clj-opt*] -X[:aliases] [a/fn] [kpath v]*
-M[:aliases]
Run main
Use aliases to modify classpath or supply main opts
clojure [clj-opt*] -M[:aliases] [init-opt*] [main-opt] [arg*]
main-opt:
-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
-h, -?, --help Print this help message and exit
-P Prepare deps - download libs, cache classpath, but don't exec
Programs provided by :deps alias:
-X:deps mvn-install Install a maven jar to the local repository cache
-X:deps git-resolve-tags Resolve git coord tags to shas and update deps.edn
For more info, see:
https://clojure.org/guides/deps_and_cli
https://clojure.org/reference/repl_and_main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment