RFR: 1275: An unknown sub-command gives a confusing error message [v3]

Erik Joelsson erikj at openjdk.java.net
Thu Dec 16 13:58:54 UTC 2021


On Thu, 16 Dec 2021 09:09:15 GMT, Guoxiong Li <gli at openjdk.org> wrote:

>> args/src/main/java/org/openjdk/skara/args/MultiCommandParser.java line 65:
>> 
>>> 63:                 return () -> p.main(forwardedArgs);
>>> 64:             }
>>> 65:             if (!"git-webrev".equals(programName) && !"git webrev".equals(programName)) {
>> 
>> I was expecting a more elegant solution to this. I would add a property/method on the Command interface that  MutliCommandParser can use to check this. Something like Command::defaultCommandExpected.
>
>> I was expecting a more elegant solution to this. I would add a property/method on the Command interface that MutliCommandParser can use to check this. Something like Command::defaultCommandExpected.
> 
> Good idea. Should we add it in this patch? Or we should file another issue to implement it?

This was meant as a suggestion for this patch. I don't think the current solution is ok to go in.

I'm not sure about the name of the new method, it's hard to come up with a good name for this property of a Command. It's trying to express if the default sub-command is expected to be run with arguments or not, or if it takes arguments at all, but putting all that in a method name becomes quite a mouthful.

-------------

PR: https://git.openjdk.java.net/skara/pull/1257


More information about the skara-dev mailing list