Skip to content

Commit

Permalink
Merge pull request #3973 from katzyn/console
Browse files Browse the repository at this point in the history
Fix Tool.showUsage() for GUIConsole
  • Loading branch information
katzyn committed Jan 20, 2024
2 parents bbb1532 + f9e3070 commit 6f234b7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions h2/src/main/org/h2/tools/GUIConsole.java
Expand Up @@ -57,6 +57,11 @@ public class GUIConsole extends Console implements ActionListener, MouseListener
private Object tray;
private Object trayIcon;

@Override
protected String getMainClassName() {
return Console.class.getName();
}

@Override
void show() {
if (!GraphicsEnvironment.isHeadless()) {
Expand Down
11 changes: 10 additions & 1 deletion h2/src/main/org/h2/util/Tool.java
Expand Up @@ -110,14 +110,23 @@ protected void showUsage() {
out.println("Cannot load " + resourceName);
}
}
String className = getClass().getName();
String className = getMainClassName();
out.println(resources.get(className));
out.println("Usage: java "+getClass().getName() + " <options>");
out.println(resources.get(className + ".main"));
out.println("See also https://h2database.com/javadoc/" +
className.replace('.', '/') + ".html");
}

/**
* Returns main class name of the tool.
*
* @return the name of the main class
*/
protected String getMainClassName() {
return getClass().getName();
}

/**
* Check if the argument matches the option.
* If the argument starts with this option, but doesn't match,
Expand Down

0 comments on commit 6f234b7

Please sign in to comment.