prefer internal tool;
authorwenzelm
Sun, 03 Apr 2016 22:31:16 +0200
changeset 62831 5560905a32ae
parent 62830 85024c0e953d
child 62832 c1410bcf6e87
prefer internal tool;
lib/Tools/doc
src/Pure/System/isabelle_tool.scala
src/Pure/Tools/doc.scala
--- a/lib/Tools/doc	Sun Apr 03 22:15:40 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-#!/usr/bin/env bash
-#
-# Author: Markus Wenzel, TU Muenchen
-#
-# DESCRIPTION: view Isabelle documentation
-
-isabelle_admin_build jars || exit $?
-
-exec isabelle java isabelle.Doc "$@"
--- a/src/Pure/System/isabelle_tool.scala	Sun Apr 03 22:15:40 2016 +0200
+++ b/src/Pure/System/isabelle_tool.scala	Sun Apr 03 22:31:16 2016 +0200
@@ -68,6 +68,8 @@
             args => Command_Line.tool0 { isabelle_tool.body(args) }))
     }
 
+  register(Doc.isabelle_tool)
+
 
   /* command line entry point */
 
--- a/src/Pure/Tools/doc.scala	Sun Apr 03 22:15:40 2016 +0200
+++ b/src/Pure/Tools/doc.scala	Sun Apr 03 22:31:16 2016 +0200
@@ -91,28 +91,26 @@
   }
 
 
-  /* command line entry point */
+  /* Isabelle tool wrapper */
 
-  def main(args: Array[String])
+  val isabelle_tool = Isabelle_Tool("doc", "view Isabelle documentation", args =>
   {
-    Command_Line.tool0 {
-      val getopts = Getopts("""
+    val getopts = Getopts("""
 Usage: isabelle doc [DOC ...]
 
   View Isabelle documentation.
 """)
-      val docs = getopts(args)
+    val docs = getopts(args)
 
-      val entries = contents()
-      if (docs.isEmpty) Console.println(cat_lines(contents_lines().map(_._2)))
-      else {
-        docs.foreach(doc =>
-          entries.collectFirst { case Doc(name, _, path) if doc == name => path } match {
-            case Some(path) => view(path)
-            case None => error("No Isabelle documentation entry: " + quote(doc))
-          }
-        )
-      }
+    val entries = contents()
+    if (docs.isEmpty) Console.println(cat_lines(contents_lines().map(_._2)))
+    else {
+      docs.foreach(doc =>
+        entries.collectFirst { case Doc(name, _, path) if doc == name => path } match {
+          case Some(path) => view(path)
+          case None => error("No Isabelle documentation entry: " + quote(doc))
+        }
+      )
     }
-  }
+  })
 }