I am trying to make a command line tool like powershell except its too limited to commands. I plan to store each command related file in a separate module because the commands are going to be niche and long. The file structure should look something like:
Main.hx
commands/
SomeModule.hx
OtherModule.hx
So I want something like a macro that will discover such modules and get a class that has the same name as filename inside the module file. For example, the class called SomeModule inside SomeModule.hx.
I am okay with any form of solution to this, I just want the classes inside modules inside the folder, without requiring to update Main.hx or similar files everytime a file is added or deleted, similar to minecraft mods, if youre familiar with.
I could not find any result in google so I came here.
So In the end, assuming the file structure is like below, I would like to call a static method on all of them.
Main.hx
commands/
SomeModule.hx
OtherModule.hx
In theory it should expand from something like:
DiscoverAndAdd(); // -> Macro call
to something like:
SomeModule.hello();
OtherModule.hello();
Thanks