-
Notifications
You must be signed in to change notification settings - Fork 85
Execute *main-cli-fn* if set and no -m #238
Conversation
src/cljs/snapshot/lumo/core.cljs
Outdated
@@ -16,3 +16,8 @@ | |||
([] (exit nil)) | |||
([code] | |||
(js/process.exit code))) | |||
|
|||
(defn run-main-cli-fn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's move this to lumo.repl
src/js/cljs.js
Outdated
@@ -437,6 +437,14 @@ async function startClojureScriptEngine(opts: CLIOptsType): Promise<mixed> { | |||
if (mainNsName) { | |||
initClojureScriptEngine(opts); | |||
runMain(mainNsName, args); | |||
} else { | |||
execute( | |||
"(do (require 'lumo.core) (lumo.core/run-main-cli-fn))", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't need to require lumo.core
if we move *main-cli-fn*
to lumo.repl
1b2eb78
to
7e61245
Compare
7e61245
to
9e83cde
Compare
src/js/cljs.js
Outdated
if (!mainNsName && !repl) { | ||
initClojureScriptEngine(opts); | ||
execute( | ||
"(require 'lumo.repl) (lumo.repl/run-main-cli-fn)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we really need to require
lumo.repl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably just create a JS function that calls lumo.repl/run-main-cli-fn
like we do above for runMain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does need to require, I tried without and It was failing. About the JS function it could be done also in another PR as refinement, but if just a wrapper, I am not sure about the value..
9e83cde
to
152f71c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
It attempts to fix #235.
but does not really compile and exits with an errorProblem solved, works very well