Skip to content

Update to the command line argument passer and logger

Gregory Ashton requested to merge fix-cli into master
  1. Switches off the help for the default argparse. This allows a child to be instantiated after.
  2. Adds a demo to the docstring of how to instantiate a child argparse
  3. Make the dependence of setup_logger on the initial command line arguments more explicit and remove a global reference.
  4. 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.

Edited by Gregory Ashton

Merge request reports

Loading