Mercurial > projects > dil
comparison 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 |
comparison
equal
deleted
inserted
replaced
730:5cb236c6fe52 | 731:ca7607226caa |
---|---|
26 import dil.File; | 26 import dil.File; |
27 | 27 |
28 import cmd.Generate; | 28 import cmd.Generate; |
29 import cmd.Statistics; | 29 import cmd.Statistics; |
30 import cmd.ImportGraph; | 30 import cmd.ImportGraph; |
31 import cmd.DDoc; | |
31 import common; | 32 import common; |
32 | 33 |
33 import Integer = tango.text.convert.Integer; | 34 import Integer = tango.text.convert.Integer; |
34 import tango.io.File; | 35 import tango.io.File; |
35 import tango.text.Util; | 36 import tango.text.Util; |
36 import tango.time.StopWatch; | 37 import tango.time.StopWatch; |
38 import tango.text.Ascii : toLower; | |
37 | 39 |
38 void main(char[][] args) | 40 void main(char[][] args) |
39 { | 41 { |
40 dil.SettingsLoader.loadSettings(); | 42 dil.SettingsLoader.loadSettings(); |
41 | 43 |
79 | 81 |
80 printSymbolTable(mod, ""); | 82 printSymbolTable(mod, ""); |
81 } | 83 } |
82 | 84 |
83 printErrors(infoMan); | 85 printErrors(infoMan); |
86 break; | |
87 case "ddoc", "d": | |
88 if (args.length < 4) | |
89 return printHelp("ddoc"); | |
90 | |
91 auto destination = args[2]; | |
92 auto macroPaths = GlobalSettings.ddocFilePaths; | |
93 char[][] filePaths; | |
94 bool incUndoc; | |
95 // Parse arguments. | |
96 foreach (arg; args[3..$]) | |
97 { | |
98 if (arg == "-i") | |
99 incUndoc = true; | |
100 else if (arg.length > 5 && toLower(arg[$-4..$]) == "ddoc") | |
101 macroPaths ~= arg; | |
102 else | |
103 filePaths ~= arg; | |
104 } | |
105 | |
106 auto infoMan = new InfoManager(); | |
107 // Execute command. | |
108 cmd.DDoc.execute(filePaths, destination, macroPaths, incUndoc, infoMan); | |
109 if (infoMan.info.length) | |
110 return printErrors(infoMan); | |
84 break; | 111 break; |
85 case "gen", "generate": | 112 case "gen", "generate": |
86 char[] fileName; | 113 char[] fileName; |
87 DocOption options = DocOption.Tokens; | 114 DocOption options = DocOption.Tokens; |
88 foreach (arg; args[2..$]) | 115 foreach (arg; args[2..$]) |
250 } | 277 } |
251 } | 278 } |
252 | 279 |
253 const char[] COMMANDS = | 280 const char[] COMMANDS = |
254 " compile (c)\n" | 281 " compile (c)\n" |
282 " ddoc (d)\n" | |
255 " generate (gen)\n" | 283 " generate (gen)\n" |
256 " help (?)\n" | 284 " help (?)\n" |
257 " importgraph (igraph)\n" | 285 " importgraph (igraph)\n" |
258 " statistics (stats)\n" | 286 " statistics (stats)\n" |
259 " tokenize (tok)\n" | 287 " tokenize (tok)\n" |
308 Options: | 336 Options: |
309 | 337 |
310 Example: | 338 Example: |
311 dil c src/main.d"; | 339 dil c src/main.d"; |
312 break; | 340 break; |
341 case "ddoc", "d": | |
342 msg = `Generate documentation from DDoc comments in D source files. | |
343 Usage: | |
344 dil ddoc Destination file.d [file2.d, ...] [Options] | |
345 | |
346 Destination is the folder where the documentation files are written to. | |
347 Files with the extension .ddoc are recognized as macro definition files. | |
348 | |
349 Options: | |
350 -i : include undocumented symbols | |
351 | |
352 Example: | |
353 dil d doc/ src/main.d mymacros.ddoc -i`; | |
354 break; | |
313 case "gen", "generate": | 355 case "gen", "generate": |
314 msg = GetMsg(MID.HelpGenerate); | 356 msg = GetMsg(MID.HelpGenerate); |
315 break; | 357 break; |
316 case "importgraph", "igraph": | 358 case "importgraph", "igraph": |
317 // msg = GetMsg(MID.HelpImportGraph); | 359 // msg = GetMsg(MID.HelpImportGraph); |