Open jlbosse opened 10 months ago
I just realized #257 is related to this, the new behavior of Julia's entry point is basically what this PR implements, but I'm not sure what's the best way of supporting this now given this is a 1.10+ feature and we are supporting all 1.6+.
AFAICT the question of what happens with the @main
macro (and if it simply gets renamed to e.g. @app
) and if we automatically run command_main()
when include
ing a Comonicon based script are independent?
Or did you have plans to make bigger changes than renaming @main
to fix #257 ?
maybe let's double check with @Keno, IIUC after shipping @main
from Base
if main
is defined then the behaviour in this PR is supported by Julia already?
Ah yes, it makes sense to see what Base.@main will do. I suppose there will be a suggested way to also support older julia versions, similar to the way there are these instructions to make weak dependencies work on older julia versions?
Yeah so I think we will have to wait for something like that before merging this PR.
Wrapped the call of
command_main()
in anif abspath(PROGRAM_FILE) == @__FILE__
to run it only if the sript is directly called from the command line. This makes it possible toinclude()
Comonicon scripts as well and use the functions defined in them in other applications as well.This addresses https://github.com/comonicon/Comonicon.jl/issues/260
Let me know if you also want me to add a sentence or two about this changed behaviour to the documentation