application: Change to argparse.ArgumentParser for preliminary parsing

Now that preliminary options are registered with the preliminary parser
on the `Application`, leverage that for parsing known options.

This important change removes the `Application.option_manager` from
being responsible for pre-configuration parsing and the workarounds
needed in the `Application.parse_preliminary_options_and_args()` to
account for the fact that `Application.option_manager` was aware of
*all* options, not just the options necessary for pre-configuration
loading.  A following commit will address removing these workarounds.
This commit is contained in:
Eric N. Vander Weele 2019-10-25 15:01:30 -04:00
parent a90200353e
commit 7f46990f4b
2 changed files with 4 additions and 3 deletions

View file

@ -138,7 +138,7 @@ class Application(object):
except ValueError:
pass
opts, args = self.option_manager.parse_known_args(args)
opts, args = self.prelim_arg_parser.parse_known_args(args)
# parse_known_args includes unknown options as args
args = [a for a in args if not a.startswith("-")]
return opts, args