diff trunk/src/main.d @ 731:ca7607226caa

Added new module cmd.DDoc. Added command 'ddoc'. Fixed scanArguments() in dil.doc.Macro.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sun, 03 Feb 2008 19:56:47 +0100
parents 140469ecb90e
children f88b5285b86b
line wrap: on
line diff
--- a/trunk/src/main.d	Sun Feb 03 18:59:34 2008 +0100
+++ b/trunk/src/main.d	Sun Feb 03 19:56:47 2008 +0100
@@ -28,12 +28,14 @@
 import cmd.Generate;
 import cmd.Statistics;
 import cmd.ImportGraph;
+import cmd.DDoc;
 import common;
 
 import Integer = tango.text.convert.Integer;
 import tango.io.File;
 import tango.text.Util;
 import tango.time.StopWatch;
+import tango.text.Ascii : toLower;
 
 void main(char[][] args)
 {
@@ -82,6 +84,31 @@
 
     printErrors(infoMan);
     break;
+  case "ddoc", "d":
+    if (args.length < 4)
+      return printHelp("ddoc");
+
+    auto destination = args[2];
+    auto macroPaths = GlobalSettings.ddocFilePaths;
+    char[][] filePaths;
+    bool incUndoc;
+    // Parse arguments.
+    foreach (arg; args[3..$])
+    {
+      if (arg == "-i")
+        incUndoc = true;
+      else if (arg.length > 5 && toLower(arg[$-4..$]) == "ddoc")
+        macroPaths ~= arg;
+      else
+        filePaths ~= arg;
+    }
+
+    auto infoMan = new InfoManager();
+    // Execute command.
+    cmd.DDoc.execute(filePaths, destination, macroPaths, incUndoc, infoMan);
+    if (infoMan.info.length)
+      return printErrors(infoMan);
+    break;
   case "gen", "generate":
     char[] fileName;
     DocOption options = DocOption.Tokens;
@@ -252,6 +279,7 @@
 
 const char[] COMMANDS =
   "  compile (c)\n"
+  "  ddoc (d)\n"
   "  generate (gen)\n"
   "  help (?)\n"
   "  importgraph (igraph)\n"
@@ -310,6 +338,20 @@
 Example:
   dil c src/main.d";
     break;
+  case "ddoc", "d":
+    msg = `Generate documentation from DDoc comments in D source files.
+Usage:
+  dil ddoc Destination file.d [file2.d, ...] [Options]
+
+  Destination is the folder where the documentation files are written to.
+  Files with the extension .ddoc are recognized as macro definition files.
+
+Options:
+  -i               : include undocumented symbols
+
+Example:
+  dil d doc/ src/main.d mymacros.ddoc -i`;
+    break;
   case "gen", "generate":
     msg = GetMsg(MID.HelpGenerate);
     break;