On Thu, 9 Apr 2026 14:26:51 GMT, Ivan Bereziuk <[email protected]> wrote:

>> I am proposing a bash auto-completion script for `jcmd` tool. It covers the 
>> tedious part of `jcmd` tool usage - <PID|main-class> and command name.
>> 
>> To guess the autocompletion candidates we make intermediate calls to `jcmd` 
>> and parse the output:
>> * run "jcmd -l" get a list of running JVMs
>> * query the list of available diagnostic commands with `jcmd <PID> help`.
>> 
>> The "-o nosort" is set to preserve ordering of candidates: The output from 
>> autocompletion (on `TAB` key press) is structured. JVM text identification 
>> <main-class|path-to-jar> immediately follows the PID of this process:
>> 
>> Example with 2 JVMs running:
>> 
>> $ jcmd -l
>> 91936 jdk.jcmd/sun.tools.jcmd.JCmd -l
>> 91668 install/MyApp.jar
>> 91769 EventGeneratorLoop 100
>> $ jcmd <TAB_key_press>
>> -l                  --help              91668               
>> install/MyApp.jar   91769               EventGeneratorLoop
>> 
>> 
>> Overall it should greatly improve QoL for `jcmd` Users.
>
> Ivan Bereziuk 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 eight additional 
> commits since the last revision:
> 
>  - Merge branch 'master' into 8357439_bash_autocomplete_for_jcmd
>  - copy the autocompletion script to the jdk image
>  - move script in bash-completion/ folder and remove extention
>  - moved the script from man to conf folder
>  - declare functions consistently
>  - more clenup
>  - copyright header. minor cleanup
>  - 8357439: add bash autocompletion for jcmd

>From a pure build point of view, these changes look good. Someone else will 
>need to weigh in on where in the JDK image we want these kind of files. My 
>understanding is that the conf dir is for files that are meant to be edited 
>post installation. At first glance I don't think that's the right location for 
>this, but I also don't know of a better location.

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

PR Review: https://git.openjdk.org/jdk/pull/30606#pullrequestreview-4083593386

Reply via email to