Path: blob/aarch64-shenandoah-jdk8u272-b10/nashorn/docs/genshelldoc.js
32278 views
/*1* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/**24* Generate HTML documentation for shell tool. Re-run this tool to regenerate25* html doc when you change options.26*27* Usage:28*29* jjs -scripting genshelldoc.js > shell.html30*/3132var Options = Packages.jdk.nashorn.internal.runtime.options.Options;33var title = "Nashorn command line shell tool";3435print(<<PREFIX36<html>37<head>38<title>39${title}40</title>41</head>42<body>43<h1>Usage</h1>44<p>45<code>46<b>jjs <options> <script-files> [ -- <script-arguments> ]</b>47</code>48</p>4950<h1>${title} options</h1>5152<table border="0">53<tr>54<th>name</th>55<th>type</th>56<th>default</th>57<th>description</th>58</tr>59PREFIX);6061for each (opt in Options.validOptions) {6263var isTimezone = (opt.type == "timezone");64var defValue = opt.defaultValue;65if (defValue == null) {66defValue = "<none>";67}6869if (isTimezone) {70// don't output current user's timezone71defValue = "<default-timezone>"72}7374print(<<ROW75<tr>76<td><b>${opt.name} ${opt.shortName == null? "" : opt.shortName}</b></td>77<td>${opt.type}</td>78<td>${defValue}</td>79<td>${opt.description}</td>80</tr>81ROW);8283}8485print(<<SUFFIX86</table>87</body>88</html>89SUFFIX);909192