248248 (doseq [[opt arg] inits]
249249 ((init-dispatch opt) arg)))
250250
251+ (defn- main-opt
252+ " Call the -main function from a namespace with string arguments from
253+ the command line."
254+ [[_ main-ns & args] inits]
255+ (with-bindings
256+ (initialize args inits)
257+ (apply (ns-resolve (doto (symbol main-ns) require ) '-main) args)))
258+
251259(defn- repl-opt
252260 " Start a repl with args and inits. Print greeting if no eval options were
253261 present"
258266 (prn )
259267 (System/exit 0 ))
260268
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-
269269(defn- script-opt
270270 " Run a script from a file, resource, or standard in with args and inits"
271271 [[path & args] inits]
@@ -326,15 +326,15 @@ java -cp clojure.jar clojure.main -i init.clj script.clj args...")
326326 With no options or args, runs an interactive Read-Eval-Print Loop
327327
328328 init options:
329- -i, --init path Load a file or resource
330- -e, --eval string Evaluate expressions in string; print non-nil values
329+ -i, --init path Load a file or resource
330+ -e, --eval string Evaluate expressions in string; print non-nil values
331331
332332 main options:
333- -r , --repl Run a repl
334- path Run a script from from a file or resource
335- -m, --main Run the -main function from a given namespace
336- - Run a script from standard input
337- -h, -?, --help Print this help message and exit
333+ -m , --main ns-name Call the -main function from a namespace with args
334+ -r, --repl Run a repl
335+ path Run a script from from a file or resource
336+ - Run a script from standard input
337+ -h, -?, --help Print this help message and exit
338338
339339 operation:
340340
@@ -343,7 +343,7 @@ java -cp clojure.jar clojure.main -i init.clj script.clj args...")
343343 - Binds *command-line-args* to a seq of strings containing command line
344344 args that appear after any main option
345345 - Runs all init options in order
346- - Runs a repl or script if requested
346+ - Calls a -main function or runs a repl or script if requested
347347
348348 The init options may be repeated and mixed freely, but must appear before
349349 any main option. The appearance of any eval option before running a repl
0 commit comments