docs/genshelldoc.js

Thu, 17 Oct 2019 13:49:11 +0100

author
andrew
date
Thu, 17 Oct 2019 13:49:11 +0100
changeset 2518
6c540cfd2593
parent 962
ac62e33a99b0
child 1205
4112748288bb
permissions
-rw-r--r--

Merge

     1 /*
     2  * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     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.
     8  *
     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).
    14  *
    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.
    18  *
    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  */
    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  */
    33 var Options = Packages.jdk.nashorn.internal.runtime.options.Options;
    34 var title = "Nashorn command line shell tool";
    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 &lt;options&gt; &lt;script-files&gt; [ -- &lt;script-arguments&gt; ]</b>
    48 </code>
    49 </p>
    51 <h1>${title} options</h1>
    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);
    62 for each (opt in Options.validOptions) {
    64 var isTimezone = (opt.type == "timezone");
    65 var defValue = opt.defaultValue;
    66 if (defValue == null) {
    67     defValue = "&lt;none&gt;";
    68 }
    70 if (isTimezone) {
    71     // don't output current user's timezone
    72     defValue = "&lt;default-timezone&gt;"
    73 }
    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);
    84 }
    86 print(<<SUFFIX
    87 </table>
    88 </body>
    89 </html>
    90 SUFFIX);

mercurial