[feature request] Run command_main()
only when running script frome the command line
#260
Labels
codegen
Julia AST codegen related issue
enhancement
New feature or request
help wanted
Extra attention is needed
It would be great if
command_main()
only gets called when the script is run from the command line and not when it isinclude()
ed e.g. in a REPL session. This would allow one to have a julia script that is on one hand usable as a CLI, but on the other hand one can also doinclude(myscript.jl)
in a REPL session or other script and use the functionality defined inmyscript.jl
from there.I suppose wrapping the call in a
if abspath(PROGRAM_FILE) == @__FILE__ command_main() end
would do that trick.The text was updated successfully, but these errors were encountered: