Update to the command line argument passer and logger
- Switches off the help for the default argparse. This allows a child to be instantiated after.
- Adds a demo to the docstring of how to instantiate a child argparse
- Make the dependence of setup_logger on the initial command line arguments more explicit and remove a global reference.
- Add some comments
The effect this has on most users is that --help
will no longer work - however the actual arguments themselves will (e.g. --clean
). While this is a mild loss (in that it isn't so easy for people to find out what is available) it will allow people to write command-line interfaces, which is probably going to be more useful in the end.
There may be a way to have both (something like this https://stackoverflow.com/questions/45806664/python-argparse-override-help-from-parent). But, I'd prefer to keep things clean for now.
I've put this as a WIP as I have yet to test it with anything other than the example given. @colm.talbot , could you perhaps give it a trial with some of your command line interfaces and see if there is anything subtle? I'm a bit worries that something will get overwritten, or not be overwritten when we are expecting it to.
Merge request reports
Activity
- Resolved by Colm Talbot
So basically, if there is a
--help
when it calls parse arguments (which it does when tupak is imported), it then prints the help and exists, but the users argparser hasn't been parsed yet. The result is the user won't see any of their options (though it would still work). I decided it's better to hobble the simpler script than the end users script.mentioned in commit d8e813c8