Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.

Execute *main-cli-fn* if set and no -m #238

Merged
merged 5 commits into from
Sep 6, 2017

Conversation

arichiardi
Copy link
Collaborator

@arichiardi arichiardi commented Aug 22, 2017

It attempts to fix #235. but does not really compile and exits with an error

Problem solved, works very well

@arichiardi arichiardi changed the title Execute *main-cli-fn* if set on startup WIP - Execute *main-cli-fn* if set on startup Aug 22, 2017
@@ -16,3 +16,8 @@
([] (exit nil))
([code]
(js/process.exit code)))

(defn run-main-cli-fn
Copy link
Owner

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))",
Copy link
Owner

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

@arichiardi arichiardi changed the title WIP - Execute *main-cli-fn* if set on startup Execute *main-cli-fn* if set and no -m Aug 22, 2017
src/js/cljs.js Outdated
if (!mainNsName && !repl) {
initClojureScriptEngine(opts);
execute(
"(require 'lumo.repl) (lumo.repl/run-main-cli-fn)",
Copy link
Owner

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

Copy link
Owner

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

Copy link
Collaborator Author

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..

Copy link
Collaborator Author

@arichiardi arichiardi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@anmonteiro anmonteiro merged commit 0ffdd66 into anmonteiro:master Sep 6, 2017
anmonteiro added a commit that referenced this pull request Sep 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Honor cljs.core/*main-cli-fn*
2 participants