Open teodorlu opened 2 years ago
A different CLI option:
hotload [OPTION...] [--] PYTHON_MODULE_OR_SCRIPT...
There's not really anything special with reloading one module.
Though perhap's it's normal? Use one python module as an entrypoint into your app, and consider other modules dependencies?
@tingstad's new feature of "also reload watched files if they are a module and have been changed since last time" is really something a bit different. It's an ergonomic solution if the user writes a main module and other modules.
Though. Do we actually need to change the CLI?
Real issues:
Hypothetical issues:
hotload -h
- in that case, hotload looks for a python file called -h
.--entrypoint=PYTHON_FUNCTION
Perhaps trying to fix the real issues directly is better than redoing the whole CLI.
Potential new stuff:
GNU CLI conventions: https://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html
Nice argparse guide: https://realpython.com/command-line-interfaces-python-argparse/
Right now, we hand roll CLI arguments. We allow something like:
But this isn't reflected in the helptext.
I know we have argparse -- but argparse can feel a bit heavy. I've used https://github.com/babashka/cli a bit recently, and I love how lightweight it is. Essentially, you specify the type of each option. The CLI lib can then return a map of all the options. Argparse might still be the way to go, not sure.
Current helptext output: