Closed bpoldrack closed 4 months ago
Attention: Patch coverage is 83.33333%
with 1 lines
in your changes are missing coverage. Please review.
Project coverage is 95.73%. Comparing base (
0bb43a2
) to head (99db308
).
Files | Patch % | Lines |
---|---|---|
onyo/main.py | 83.33% | 0 Missing and 1 partial :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This patch tries to workaround an issue with
argparse
, where an error on unrecognized arguments, is not associated with the selected subparser. See https://bugs.python.org/issue34479Solution here is, to rely on
parse_known_args
instead ofparse_args
, returning unrecognized arguments in a dedicated list and call the subparsersprint_usage
in addition to reproducing the toplevel parsers' error.The reason for doing both, is because we can't distinguish
onyo -x new
fromonyo new -x
via argparse (we'd need to reparseargv
ourselves). Hence, it's not clear in all cases, whether the usage fornew
oronyo
would be relevant to the user.So, in the above example this path ends up with:
(exact same for
onyo new -x
)Still: A lot better than before, I think.
(Closes #356) (Closes #408)