src/Pure/Tools/build_doc.scala
changeset 62435 2c390ad93bc8
parent 61276 8a4bd05c1735
child 62454 38c89353b349
equal deleted inserted replaced
62434:4630b1748cb3 62435:2c390ad93bc8
    70   /* command line entry point */
    70   /* command line entry point */
    71 
    71 
    72   def main(args: Array[String])
    72   def main(args: Array[String])
    73   {
    73   {
    74     Command_Line.tool {
    74     Command_Line.tool {
    75       args.toList match {
    75       var all_docs = false
    76         case
    76       var max_jobs = 1
    77           Properties.Value.Boolean(all_docs) ::
    77       var system_mode = false
    78           Properties.Value.Int(max_jobs) ::
    78 
    79           Properties.Value.Boolean(system_mode) ::
    79       val getopts =
    80           Command_Line.Chunks(docs) =>
    80         Getopts(() => """
    81             val options = Options.init()
    81 Usage: isabelle build_doc [OPTIONS] [DOCS ...]"
    82             val progress = new Console_Progress()
    82 
    83             progress.interrupt_handler {
    83   Options are:
    84               build_doc(options, progress, all_docs, max_jobs, system_mode, docs)
    84     -a           select all documentation sessions
    85             }
    85     -j INT       maximum number of parallel jobs (default 1)
    86         case _ => error("Bad arguments:\n" + cat_lines(args))
    86     -s           system build mode
       
    87 
       
    88   Build Isabelle documentation from documentation sessions with
       
    89   suitable document_variants entry.
       
    90 """,
       
    91         "a" -> (_ => all_docs = true),
       
    92         "j:" -> (arg => max_jobs = Properties.Value.Int.parse(arg)),
       
    93         "s" -> (_ => system_mode = true))
       
    94 
       
    95       val docs = getopts(args)
       
    96 
       
    97       if (!all_docs && docs.isEmpty) getopts.usage()
       
    98 
       
    99       val options = Options.init()
       
   100       val progress = new Console_Progress()
       
   101       progress.interrupt_handler {
       
   102         build_doc(options, progress, all_docs, max_jobs, system_mode, docs)
    87       }
   103       }
    88     }
   104     }
    89   }
   105   }
    90 }
   106 }
    91