core icon indicating copy to clipboard operation
core copied to clipboard

Running `ocrd` or a processor without arguments should output `--help` AND return 1

Open kba opened this issue 1 year ago • 4 comments

          It looks like I should run `ocrd-froc-recognize --help` to get a result code of 0 if there is no crash instead of running `ocrd-froc-recognize` without any argument which always returns 1, even with Python 3.7 and Python 3.8 where it does not crash.

Most OCR-D processors return 1 when they are called without any argument, but ocrd from core is an exception which returns 0. Should that be changed?

Originally posted by @stweil in https://github.com/OCR-D/ocrd_froc/issues/13#issuecomment-2053953307

kba avatar Apr 15 '24 15:04 kba

Most OCR-D processors return 1 when they are called without any argument, but ocrd from core is an exception which returns 0. Should that be changed?

I don't think so. Both behaviours are well documented. Processors adhere to the OCR-D CLI specification, and ocrd (being a multi-task CLI and not part of the spec) just yields the --help output, which is the most useful default.

bertsky avatar Apr 16 '24 10:04 bertsky

@bertsky, thank you for pointing to the OCR-D CLI specification. Where is it documented that running ocrd without an argument should return 0? If there is no such documentation, it should be changed to return 1 for consistency with OCR-D processors and common command line tools like cp and others.

stweil avatar Apr 16 '24 12:04 stweil

Where is it documented that running ocrd without an argument should return 0?

That's click's default (because traditionally that's how multi-task CLI behave).

If there is no such documentation, it should be changed to return 1 for consistency with OCR-D processors

I totally disagree.

First of all, this would break existing usage without even a reason.

Second, there is simply no need for "consistency" with OCR-D processors, as this is a different kind of CLI, as I have already pointed out.

bertsky avatar Apr 16 '24 12:04 bertsky

That's click's default (because traditionally that's how multi-task CLI behave).

Please give more evidence for that statement. I just tried git. Is that a multi-task CLI? How does it behave?

First of all, this would break existing usage without even a reason.

Do you have a real-life example of this?

stweil avatar Apr 16 '24 12:04 stweil