picocli icon indicating copy to clipboard operation
picocli copied to clipboard

Customize error messages

Open vonZeppelin opened this issue 3 years ago • 3 comments

Hi!

Is it possible to customize the following errors / messages?

  • "Missing required subcommand"
  • "Unmatched argument at index " (misspelled command or unexpected option / subcommand provided)
  • "Did you mean ... ?" (command hint)

Thank you.

vonZeppelin avatar Sep 02 '21 08:09 vonZeppelin

Hi @vonZeppelin

No this is currently not possible, error messages are hard-coded as of picocli 4.6.1. Possibly related issue is this one: https://github.com/remkop/picocli/issues/485

Pull requests are always welcome! 😉

remkop avatar Sep 02 '21 09:09 remkop

Hi @remkop,

Thank you for such quick response!

So as I understand it's possible to change behaviour / message for "Missing required option: ..." case by providing custom IParameterExceptionHandler, would it be similar direction for cases listed above?

Thank you!

vonZeppelin avatar Sep 02 '21 10:09 vonZeppelin

Yes I believe so.

remkop avatar Sep 02 '21 10:09 remkop