private void Run (string[] args)
{
subcommands = new Dictionary<string, MDocCommand> () {
{ "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 () },
};
bool showVersion = false;
bool showHelp = false;
var p = new OptionSet () {
{ "version", v => showVersion = v != null },
{ "v:", (int? v) => verbosity = v.HasValue ? v.Value : verbosity+1 },
{ "debug", v => debug = v != null },
{ "h|?|help", v => showHelp = v != null },
new ResponseFileSource (),
};
var extra = p.Parse (args);
if (showVersion) {
Console.WriteLine ("mdoc {0}", Consts.MonoVersion);
return;
}
if (extra.Count == 0) {
Console.WriteLine ("Use `mdoc help' for usage.");
return;
}
if (showHelp) {
extra.Add ("--help");
}
switch (extra [0]) {
case "x-msitomsx":
new MsidocToMsxdocConverter ().Run (extra);
break;
default:
GetCommand (extra [0]).Run (extra);
break;
}
}