File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 801
801
(evaluator '(run! require uclj.core/namespaces-to-require))
802
802
(cond
803
803
(and (first args) (.startsWith (str (first args)) " (" ))
804
- (println (evaluator (read-string (first args))))
804
+ (binding [*command-line-args* (second args)]
805
+ (println (evaluator (read-string (first args)))))
805
806
806
807
(and (first args) (.exists (io/file (first args))))
807
- (do (evaluator `(load-file ~(first args)))
808
- (when (= " --test" (second args))
809
- (let [test-result (apply clojure.test/run-tests (all-test-namespaces ))]
810
- (when-not (zero? (:fail test-result))
811
- (System/exit 1 )))))
808
+ (let [test? (= " --test" (second args))]
809
+ (binding [*command-line-args* (if test? (nnext args) (next args))]
810
+ (evaluator `(load-file ~(first args))))
811
+ (when test?
812
+ (let [test-result (apply clojure.test/run-tests (all-test-namespaces ))]
813
+ (when-not (zero? (:fail test-result))
814
+ (System/exit 1 )))))
812
815
813
816
:else ; ; interactive mode
814
817
(do (println " Welcome to the small interpreter!" )
818
+ (var-set-reset! #'*command-line-args* args)
815
819
(doseq [v [#'*1 #'*2 #'*3 #'*e]] (var-set-reset! v nil ))
816
820
(loop []
817
821
(print (str (ns-name *ns*) " => " )) (flush )
You can’t perform that action at this time.
0 commit comments