On Tue, 2 Jul 2024 15:21:49 GMT, Sonia Zaldana Calles <szald...@openjdk.org> 
wrote:

>> Hi all, 
>> 
>> This PR addresses [8332124](https://bugs.openjdk.org/browse/JDK-8332124) 
>> enabling jcmd to accept "help" as an argument to subcommands. 
>> 
>> Testing: 
>> - [x] Verified running `jcmd 4711 VM.metaspace help` works along with other 
>> subcommands. 
>> - [x] Added test case passes. 
>> 
>> Thanks, 
>> Sonia
>
> Sonia Zaldana Calles has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Making enabling help more restrictive. Will not accept -help

Hi,

1.
The JBS issue and PR title need an update. Maybe something like:

  Jcmd should recognise options that look like requests for help


2.
I would encourage recognising "-help" in this change.  This is contrary to 
Thomas' suggestion, and I see the clash with posix style --options, but we 
already have many many single-minus-prefixed options.  This change as I see it 
is an undocumented attempt to help lost users.  If we start a migration to 
posix-style, much effort will be needed so this clash, which could be fixed 
then, will seem insignificant.


3.
I want to mention the alternative to this change: print the command help 
whenever showing an error.  The downside would be that it can be quite long, 
and maybe you don't want to see several screens of help when you mistype one 
option to jcmd JFR.start...
I think we should complete what we have here already, but we should note that 
there are alternatives.


4.
sun/tools/jcmd/TestJcmdSubcommandHelp.java
The summary at line 28 needs updating, whether you add "-help" or not.

Would be great to test "jcmd VM.command -hello" and check it does not show 
help.  I added one and tried it out, will paste it in here somehow.


Thanks!

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

PR Comment: https://git.openjdk.org/jdk/pull/19776#issuecomment-2205920976

Reply via email to