lowercase flag

This commit is contained in:
Ivan Bereziuk 2026-01-22 12:05:01 +01:00
parent f4ee92ee37
commit aa1d92cc88
6 changed files with 13 additions and 13 deletions

View File

@ -389,7 +389,7 @@ static JcmdOptions parse_common_options(const CmdLine& line, stringStream *updat
JcmdOptions options = {0};
// there is only TIMESTAMP option so far
const char TIMESTAMP[] = "-T";
const char TIMESTAMP[] = "-t";
const char* line_str = line.cmd_addr();

View File

@ -166,7 +166,7 @@ public:
struct JcmdOptions {
bool timestamp;
bool timestamp; // a timestamp was requsted with "-t" flag
};
// The DCmdParser class can be used to create an argument parser for a

View File

@ -65,9 +65,9 @@ class Arguments {
processString = args[argsCounter];
argsCounter++;
// common flags: [-T]
// common flags: [-t]
if (argsCounter < args.length // "jcmd <PID>" is not an error and acts as "jcmd <PID> help"
&& args[argsCounter].equals("-T")) {
&& args[argsCounter].equals("-t")) {
sb.append(args[argsCounter]).append(" ");
argsCounter++;
@ -123,11 +123,11 @@ class Arguments {
}
public static void usage() {
System.out.println("Usage: jcmd <pid | main class> [-T] <command ...|PerfCounter.print|-f file>");
System.out.println("Usage: jcmd <pid | main class> [-t] <command ...|PerfCounter.print|-f file>");
System.out.println(" or: jcmd -l ");
System.out.println(" or: jcmd <-h | --help> ");
System.out.println(" ");
System.out.println(" -T flag ensures the dignostic command begins with a timestamp ");
System.out.println(" -t flag ensures the dignostic command begins with a timestamp ");
System.out.println(" ");
System.out.println(" command must be a valid jcmd command for the selected JVM. ");
System.out.println(" Use the command \"help\" to see which commands are available. ");

View File

@ -33,7 +33,7 @@ jcmd - send diagnostic command requests to a running Java Virtual Machine
## Synopsis
`jcmd` \[*pid* \| *main-class*\] [`-T`] *command*... \| `PerfCounter.print` \| `-f`
`jcmd` \[*pid* \| *main-class*\] [`-t`] *command*... \| `PerfCounter.print` \| `-f`
*filename*
`jcmd` \[`-l`\]
@ -48,7 +48,7 @@ jcmd - send diagnostic command requests to a running Java Virtual Machine
: When used, the `jcmd` utility sends the diagnostic command request to all
Java processes with the specified name of the main class.
`-T`
`-t`
: When used, the diagnostic commands output starts with a timestamp.
*command*

View File

@ -33,16 +33,16 @@ import jdk.test.lib.process.OutputAnalyzer;
/*
* @test
* @summary test jcmd generic flag "-T" to make sure dignostic coommand is timestamped
* @summary test jcmd generic flag "-t" to make sure dignostic coommand is timestamped
* @library /test/lib
* @run main/othervm TestJcmdTimestamp
*/
public class TestJcmdTimestamp {
public static void main(String[] args) throws Exception {
TestJcmdTimestamp(new PidJcmdExecutor(), "-T VM.version", true /* expectTimestamp */);
TestJcmdTimestamp(new PidJcmdExecutor(), "-t VM.version", true /* expectTimestamp */);
TestJcmdTimestamp(new PidJcmdExecutor(), "VM.version", false /* expectTimestamp */);
TestJcmdTimestamp(new FileJcmdExecutor(), "-T VM.version", true /* expectTimestamp */);
TestJcmdTimestamp(new FileJcmdExecutor(), "-t VM.version", true /* expectTimestamp */);
TestJcmdTimestamp(new FileJcmdExecutor(), "VM.version", false /* expectTimestamp */);
}

View File

@ -1,8 +1,8 @@
Usage: jcmd <pid | main class> [-T] <command ...|PerfCounter.print|-f file>
Usage: jcmd <pid | main class> [-t] <command ...|PerfCounter.print|-f file>
or: jcmd -l
or: jcmd <-h | --help>
-T flag ensures the dignostic command begins with a timestamp
-t flag ensures the dignostic command begins with a timestamp
command must be a valid jcmd command for the selected JVM.
Use the command "help" to see which commands are available.