jhove icon indicating copy to clipboard operation
jhove copied to clipboard

JHOVE doesn't handle chained command line flags properly

Open carlwilson opened this issue 7 years ago • 8 comments

JHOVE uses custom code for parsing command line parameters that doesn't support chaining flags. For example intuitively jhove -kr should enable checksumming and the use of raw data flags but this only happens if jhove -k -r is used.

carlwilson avatar Mar 21 '19 14:03 carlwilson

If you haven't already settled on something else, I really like JCommander for CLI options.

marhop avatar Mar 21 '19 20:03 marhop

JCommander seems indeed a well-supported library to do that. It has no extra-dependencies, is Apache 2-0 license, requires Java 8.

Another library that appears when searching is picocli: no extra-dependencies, Apache 2.0 license, works with Java 5. The comparison , made by the author itself, insists in the fact that it can be integrated as source (no dependency at all) and it Supports for clustered POSIX short options, which is what this issue is about...

tledoux avatar Mar 22 '19 18:03 tledoux

Oops, you're right! I thought JCommander supported clustered options, but I haven't checked in a while (seems it does not). Indeed picocli looks nice, and it even supports autocomplete.

marhop avatar Mar 23 '19 20:03 marhop

Hi, @DinoAGW is this the right issue to assign you to, or more accurately is this your GitHub id? I'm happy to help move this along or write some unit tests. It's a bit cheeky but if we're going to replace this with picoli then we might look at #413 as well which is related.

carlwilson avatar Apr 28 '20 17:04 carlwilson

@carlwilson yes, I am. That would be great. I'm looking forward to start with making myself familiar with picoli.

DinoAGW avatar Apr 30 '20 07:04 DinoAGW

That's great @DinoAGW, I'll likely not start until tomorrow but will get a few tests written. There's some implied refactoring here as the code's not testable in its current state. It'll need a dedicated parsing class that returns some kind of config instance, at least in my head. I might need to do that as I write the tests.

carlwilson avatar Apr 30 '20 07:04 carlwilson

here is a first allmost complete try to solve it. There are a few //TODO and "tbd"s in there because I don't know Jhove, Java and englisch well enough to make everything professional by myself, but I think, it is ready to get testet.

DinoAGW avatar Jun 10 '20 15:06 DinoAGW