[feature request] Run `command_main()` only when running script frome the command line
It would be great if command_main() only gets called when the script is run from the command line and not when it is include()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 do include(myscript.jl) in a REPL session or other script and use the functionality defined in myscript.jl from there.
I suppose wrapping the call in a if abspath(PROGRAM_FILE) == @__FILE__ command_main() end would do that trick.
I think this is possible. And I like this idea! could be supported by adding your change here https://github.com/comonicon/Comonicon.jl/blob/main/src/frontend/cast.jl#L461, please feel free to open a PR for this!
Great, I will try to find some time create a PR for this then!