File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 258258 (prn )
259259 (System/exit 0 ))
260260
261+ (defn- main-opt
262+ " Run the -main function from a given namespace with arguments taken from
263+ the command line."
264+ [[_ main-ns & args] inits]
265+ (with-bindings
266+ (initialize args inits)
267+ (apply (ns-resolve (doto (symbol main-ns) require ) '-main) args)))
268+
261269(defn- script-opt
262270 " Run a script from a file, resource, or standard in with args and inits"
263271 [[path & args] inits]
284292 (or
285293 ({" -r" repl-opt
286294 " --repl" repl-opt
295+ " -m" main-opt
296+ " --main" main-opt
287297 nil null-opt
288298 " -h" help-opt
289299 " --help" help-opt
@@ -322,6 +332,7 @@ java -cp clojure.jar clojure.main -i init.clj script.clj args...")
322332 main options:
323333 -r, --repl Run a repl
324334 path Run a script from from a file or resource
335+ -m, --main Run the -main function from a given namespace
325336 - Run a script from standard input
326337 -h, -?, --help Print this help message and exit
327338
You can’t perform that action at this time.
0 commit comments