Possiblity to show only Option Key when UnmatchedArgumentException is thrown

6 views
Skip to first unread message

Dominik Guhr

unread,
Feb 7, 2022, 11:27:43 AM2/7/22
to picocli
Hey remko and picocli team :)

Our Keycloak CLI implementation evolved a bit, and now we are facing a likely minor issue, nevertheless I wanted to reach out to you all to ask for advice:

In general, it is possible to provide an option to some commands in our CLI like so:

kc.sh <command> --<optionkey>=<value>

Now when there's a typo in the key, the error message always shows "Unknown option: <optionkey>=<value>".

This leads in some cases to e.g. a database password being leaked to the console, and thus possibly to logs, which should not happen. That's exactly the use case we have atm, so I searched around but have not found a way to set a handler for the UnmatchedArgumentException, as it is possible for e.g. ExecutionException or ParameterException.

Our issue is described in more detail here: https://github.com/keycloak/keycloak/issues/10050

So, my question for now would be: Is there actually a way I miss to show only the key of the unknown option instead of key=value? so when I e.g. run kc.sh start-dev --db-pasword=foo the output would be just "Unknown option: --db-pasword"?

Would love to hear from you.

Thanks and best regards,
Dominik

Remko Popma

unread,
Feb 7, 2022, 4:23:20 PM2/7/22
to Dominik Guhr, picocli
Hi Dominik,

I raised https://github.com/remkop/picocli/issues/1565 for this, it is easier for me to discuss on GitHub.
I will put more comments on that GitHub issue.

Remko

--
You received this message because you are subscribed to the Google Groups "picocli" group.
To unsubscribe from this group and stop receiving emails from it, send an email to picocli+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/picocli/13ba1e33-9f3a-4fa5-be7b-8bcf3eae893fn%40googlegroups.com.

Dominik Guhr

unread,
Feb 8, 2022, 1:21:47 PM2/8/22
to picocli
Hey,

thanks for your answers so far! Really appreciated :) We're trying to get keycloak 17 with quarkus and picocli out at the moment, so I don't think I can look more into it until end of week-ish, but I'll answer then in the issues for sure. Thanks again!

Best regards,
Dominik

Reply all
Reply to author
Forward
0 new messages