On Tue, 25 Jun 2024 13:55:32 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 with a new target base due > to a merge or a rebase. The incremental webrev excludes the unrelated changes > brought in by the merge/rebase. The pull request contains three additional > commits since the last revision: > > - Merge branch 'openjdk:master' into JDK-8332124 > - Adding test case for suboptions with trailing spaces and adding null > terminator to reordered command > - 8332124: Jcmd processing should accept the "help" sub option as command > argument @SoniaZaldana, thank you for addressing this, this has been bugging me for a long time (hence the issue). @kevinjwalls > I could benefit from this, I think it's natural to sometimes want to check > the help after you've started typing, so I like the idea. But can it actually > clash with any other usage? good point > Any thoughts on if jcmd PID command -help or jcmd PID command --help Yes, something like that seems the only obvious solution. Regrettably, we follow no standard at all for jcmd argument formats. I have been wishing for years that we would follow something consistent, e.g. the [Posix utility argument syntax](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_01). Or however the Gnu variant is called with their double-dash arguments. Something like "--help" would probably not clash with anything, e.g. also not with a future introduction of Posix utility argument syntax (dash-multiple-flags). Or, something like "-h". But we would have to examine all commands. Sigh. Maybe adding "-h" to each command would have been the better way, if we need to examine every command anyway to check for compat problems. Or, to the command base classes. Lets see what other reviewers think. > > ..where I guess it's not the "help" which is unknown. Is the user better > served by just giving the help and ignoring the additional "nonsense"? Yes. We should ignore trailing arguments after --help ------------- PR Comment: https://git.openjdk.org/jdk/pull/19776#issuecomment-2190847478