author | mchung |
Fri, 29 Aug 2014 20:16:35 -0700 | |
changeset 28544 | a132e8e301e5 |
parent 26067 | b32ccc3a76c9 |
permissions | -rw-r--r-- |
16147 | 1 |
/* |
16151 | 2 |
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
16147 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
26067
b32ccc3a76c9
8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents:
16151
diff
changeset
|
4 |
* |
16147 | 5 |
* This code is free software; you can redistribute it and/or modify it |
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
26067
b32ccc3a76c9
8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents:
16151
diff
changeset
|
8 |
* |
16147 | 9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
26067
b32ccc3a76c9
8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents:
16151
diff
changeset
|
14 |
* |
16147 | 15 |
* You should have received a copy of the GNU General Public License version |
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
26067
b32ccc3a76c9
8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents:
16151
diff
changeset
|
18 |
* |
16147 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
/** |
|
25 |
* Generate HTML documentation for shell tool. Re-run this tool to regenerate |
|
26 |
* html doc when you change options. |
|
27 |
* |
|
28 |
* Usage: |
|
29 |
* |
|
30 |
* jjs -scripting genshelldoc.js > shell.html |
|
31 |
*/ |
|
32 |
||
33 |
var Options = Packages.jdk.nashorn.internal.runtime.options.Options; |
|
34 |
var title = "Nashorn command line shell tool"; |
|
35 |
||
36 |
print(<<PREFIX |
|
37 |
<html> |
|
38 |
<head> |
|
39 |
<title> |
|
40 |
${title} |
|
41 |
</title> |
|
42 |
</head> |
|
43 |
<body> |
|
44 |
<h1>Usage</h1> |
|
45 |
<p> |
|
46 |
<code> |
|
47 |
<b>jjs <options> <script-files> [ -- <script-arguments> ]</b> |
|
48 |
</code> |
|
49 |
</p> |
|
50 |
||
51 |
<h1>${title} options</h1> |
|
52 |
||
53 |
<table border="0"> |
|
54 |
<tr> |
|
55 |
<th>name</th> |
|
56 |
<th>type</th> |
|
57 |
<th>default</th> |
|
58 |
<th>description</th> |
|
59 |
</tr> |
|
60 |
PREFIX); |
|
61 |
||
62 |
for each (opt in Options.validOptions) { |
|
63 |
||
26067
b32ccc3a76c9
8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents:
16151
diff
changeset
|
64 |
var isTimezone = (opt.type == "timezone"); |
16147 | 65 |
var defValue = opt.defaultValue; |
66 |
if (defValue == null) { |
|
67 |
defValue = "<none>"; |
|
68 |
} |
|
69 |
||
70 |
if (isTimezone) { |
|
71 |
// don't output current user's timezone |
|
72 |
defValue = "<default-timezone>" |
|
73 |
} |
|
74 |
||
75 |
print(<<ROW |
|
76 |
<tr> |
|
77 |
<td><b>${opt.name} ${opt.shortName == null? "" : opt.shortName}</b></td> |
|
78 |
<td>${opt.type}</td> |
|
79 |
<td>${defValue}</td> |
|
80 |
<td>${opt.description}</td> |
|
81 |
</tr> |
|
82 |
ROW); |
|
83 |
||
84 |
} |
|
85 |
||
86 |
print(<<SUFFIX |
|
87 |
</table> |
|
88 |
</body> |
|
89 |
</html> |
|
90 |
SUFFIX); |