Merge pull request #2218 from mono/assignProjectConfigurtionFix
[mono.git] / mcs / tools / mdoc / Mono.Documentation / mdoc.cs
index 14e45fd97e02bf2e2e49b96b17979907e779a232..207d6cb40f911ba5cda004fefb7b8665b655082d 100644 (file)
@@ -2,7 +2,9 @@
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.IO;
 using System.Linq;
+using System.Text;
 using Mono.Options;
 
 namespace Mono.Documentation {
@@ -24,7 +26,8 @@ namespace Mono.Documentation {
                                else {
                                        Console.Error.WriteLine ("mdoc: {0}", e.Message);
                                }
-                               Console.Error.WriteLine ("See `mdoc help' for more information.");
+                               Console.Error.WriteLine ("See `mdoc help' for more information or use --debug to diagnose.");
+                               Environment.ExitCode = 1;
                        }
                }
 
@@ -38,10 +41,14 @@ namespace Mono.Documentation {
                                { "assemble",         new MDocAssembler () },
                                { "dump-tree",        new MDocTreeDumper () },
                                { "export-html",      new MDocToHtmlConverter () },
+                               { "export-html-webdoc",   new MDocExportWebdocHtml () },
                                { "export-msxdoc",    new MDocToMSXDocConverter () },
                                { "help",             new MDocHelpCommand (this) },
                                { "update",           new MDocUpdater () },
+                               { "update-ecma-xml",  new MDocUpdateEcmaXml () },
                                { "validate",         new MDocValidator () },
+                               { "index",            new MDocIndex () },
+                               { "preserve",         new MDocPreserve () }
                        };
 
                        bool showVersion = false;
@@ -51,21 +58,30 @@ namespace Mono.Documentation {
                                { "v:",       (int? v) => verbosity = v.HasValue ? v.Value : verbosity+1 },
                                { "debug",    v => debug = v != null },
                                { "h|?|help", v => showHelp = v != null },
+                               new ResponseFileSource (),
                        };
 
-                       List<string> extra = p.Parse (args);
+                       var extra = p.Parse (args);
 
                        if (showVersion) {
-                               Console.WriteLine ("mdoc 0.1.0");
+                               Console.WriteLine ("mdoc {0}", Consts.MonoVersion);
                                return;
                        }
                        if (extra.Count == 0) {
-                               new MDocHelpCommand (this).Run (null);
+                               Console.WriteLine ("Use `mdoc help' for usage.");
+                               return;
                        }
                        if (showHelp) {
                                extra.Add ("--help");
                        }
-                       GetCommand (extra [0]).Run (extra);
+                       switch (extra [0]) {
+                               case "x-msitomsx":
+                                       new MsidocToMsxdocConverter ().Run (extra);
+                                       break;
+                               default: 
+                                       GetCommand (extra [0]).Run (extra);
+                                       break;
+                       }
                }
 
                internal MDocCommand GetCommand (string command)