-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
show help for no-arg processor calls, fix #562, fix #274 #586
Conversation
Codecov Report
@@ Coverage Diff @@
## master #586 +/- ##
=======================================
Coverage 84.87% 84.87%
=======================================
Files 52 52
Lines 2890 2890
Branches 564 564
=======================================
Hits 2453 2453
Misses 328 328
Partials 109 109
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Energize!
This sometimes breaks running a test using
The call/ Edit: I worked around it by setting |
This is a surprisingly tricky-to-implement problem: We want processor calls without any arguments to print the help screen and exit with code1
, i.e. ifsys.argv[2:] == []
.It really isn't, it was just hard to test because sys.argv contained the arguments to pytest, not to the CLI. Turns out, sys.argv can be overridden at runtime for the tests and checking
not sys.argv[1:]
was enoughHowever, I could not find a way to get the un-procesed command line arguments to click. `get_current_context()` does have an `args` property but that only contains the remaining positional arguments after parsing.
If anyone knows a better way to get the click equivalent of
sys.argv[2:]
, I'd be interested!For now, I've disabled the defaults for
input_file_grp
/output_file_grp
(as proposed in #274) and check for all relevant CLI options one-by-one:As I said before, I would prefer a more robust solution. The clause above will also trigger for processors being called with
--mets mets.xml
but neither input nor output file group (such as the ocrd-sanitize processor...).