8189102: All tools should support -?, -h and --help

Reviewed-by: kvn, jjg, weijun, alanb, rfield, ksrini
This commit is contained in:
Goetz Lindenmaier 2018-01-16 08:48:34 +01:00
parent 1655b15477
commit 22762d1cdc
59 changed files with 680 additions and 152 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -122,7 +122,11 @@ public class Main {
}
}
continue;
} else if (arg.equals("-?") || arg.equals("-help")) {
} else if (arg.equals("-?") ||
arg.equals("-h") ||
arg.equals("--help") ||
// -help: legacy.
arg.equals("-help")) {
usage(EXIT_SUCCESS);
} else if (arg.equals("-e")) {
seenScript = true;

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -55,8 +55,7 @@ where [options] include:\n\
\ \-f <script file> Evaluate given script file \n\
\ \-f - Interactive mode, read script from standard input \n\
\ \ If this is used, this should be the last -f option \n\
\ \-help Print this usage message and exit \n\
\ \-? Print this usage message and exit \n\
\ \-? -h --help -help Print this help message and exit \n\
\ \-q List all scripting engines available and exit \n\
\ \n\
If [arguments..] are present and if no -e or -f option is used, then first\n\