src/Pure/Tools/build_doc.scala
changeset 62838 c91ca9935280
parent 62641 0b1b7465f2ef
child 63805 c272680df665
equal deleted inserted replaced
62837:237ef2bab6c7 62838:c91ca9935280
    65     }
    65     }
    66     else res1.rc
    66     else res1.rc
    67   }
    67   }
    68 
    68 
    69 
    69 
    70   /* command line entry point */
    70   /* Isabelle tool wrapper */
    71 
    71 
    72   def main(args: Array[String])
    72   val isabelle_tool = Isabelle_Tool("build_doc", "build Isabelle documentation", args =>
    73   {
    73   {
    74     Command_Line.tool {
    74     var all_docs = false
    75       var all_docs = false
    75     var max_jobs = 1
    76       var max_jobs = 1
    76     var system_mode = false
    77       var system_mode = false
       
    78 
    77 
    79       val getopts =
    78     val getopts =
    80         Getopts("""
    79       Getopts("""
    81 Usage: isabelle build_doc [OPTIONS] [DOCS ...]"
    80 Usage: isabelle build_doc [OPTIONS] [DOCS ...]"
    82 
    81 
    83   Options are:
    82   Options are:
    84     -a           select all documentation sessions
    83     -a           select all documentation sessions
    85     -j INT       maximum number of parallel jobs (default 1)
    84     -j INT       maximum number of parallel jobs (default 1)
    86     -s           system build mode
    85     -s           system build mode
    87 
    86 
    88   Build Isabelle documentation from documentation sessions with
    87   Build Isabelle documentation from documentation sessions with
    89   suitable document_variants entry.
    88   suitable document_variants entry.
    90 """,
    89 """,
    91         "a" -> (_ => all_docs = true),
    90       "a" -> (_ => all_docs = true),
    92         "j:" -> (arg => max_jobs = Properties.Value.Int.parse(arg)),
    91       "j:" -> (arg => max_jobs = Properties.Value.Int.parse(arg)),
    93         "s" -> (_ => system_mode = true))
    92       "s" -> (_ => system_mode = true))
    94 
    93 
    95       val docs = getopts(args)
    94     val docs = getopts(args)
    96 
    95 
    97       if (!all_docs && docs.isEmpty) getopts.usage()
    96     if (!all_docs && docs.isEmpty) getopts.usage()
    98 
    97 
    99       val options = Options.init()
    98     val options = Options.init()
   100       val progress = new Console_Progress()
    99     val progress = new Console_Progress()
       
   100     val rc =
   101       progress.interrupt_handler {
   101       progress.interrupt_handler {
   102         build_doc(options, progress, all_docs, max_jobs, system_mode, docs)
   102         build_doc(options, progress, all_docs, max_jobs, system_mode, docs)
   103       }
   103       }
   104     }
   104     sys.exit(rc)
   105   }
   105   })
   106 }
   106 }