Closed cap5lut closed 2 years ago
Maybe it is better to return a List<String>
from Command#getUsage()
and then in BaseParameterParser#parse
assemble the separate usages together as that is where the semantic and syntax are defined.
And in TypedParameterParser#parse
you would search for the first usage string where the invalid parameter type is used and use that in the error message.
What do you think?
Hm, maybe even better a second attribute for @Usage
called description
where you can add a descirption for the usage variant and then return a Map<String, Optional<String>>
, then a help command can show usage variants with individual descriptions if available.
I'm not sure I like the idea of combining the usage strings in
Command#getUsage
. It feels wrong, because neitherCommand#getUsage
, nor@Usage
are the ones that define how a usage string has to look like, the format is arbitrary. If you use theParameterParser
, then it has to follow that syntax defined there and only then it makes sense to combine the individual usages that way.