comparison trunk/src/main.d @ 703:bf10602159c1

Added static and public import styles to 'igraph' command.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sun, 27 Jan 2008 20:51:19 +0100
parents f14cd41fc87d
children d75aad38d1b2
comparison
equal deleted inserted replaced
702:e10838e0b182 703:bf10602159c1
104 break; 104 break;
105 case "importgraph", "igraph": 105 case "importgraph", "igraph":
106 string filePath; 106 string filePath;
107 string[] includePaths; 107 string[] includePaths;
108 string[] regexps; 108 string[] regexps;
109 string siStyle = "dashed"; // static import style
110 string piStyle = "bold"; // public import style
109 uint levels; 111 uint levels;
110 IGraphOption options; 112 IGraphOption options;
111 foreach (arg; args[2..$]) 113 foreach (arg; args[2..$])
112 { 114 {
113 if (strbeg(arg, "-I")) 115 if (strbeg(arg, "-I"))
114 includePaths ~= arg[2..$]; 116 includePaths ~= arg[2..$];
115 else if(strbeg(arg, "-r")) 117 else if(strbeg(arg, "-r"))
116 regexps ~= arg[2..$]; 118 regexps ~= arg[2..$];
117 else if(strbeg(arg, "-l")) 119 else if(strbeg(arg, "-l"))
118 levels = Integer.toInt(arg[2..$]); 120 levels = Integer.toInt(arg[2..$]);
121 else if(strbeg(arg, "-si"))
122 siStyle = arg[3..$];
123 else if(strbeg(arg, "-pi"))
124 piStyle = arg[3..$];
119 else 125 else
120 switch (arg) 126 switch (arg)
121 { 127 {
122 case "--dot": 128 case "--dot":
123 options |= IGraphOption.PrintDot; break; 129 options |= IGraphOption.PrintDot; break;
139 options |= IGraphOption.MarkCyclicModules; break; 145 options |= IGraphOption.MarkCyclicModules; break;
140 default: 146 default:
141 filePath = arg; 147 filePath = arg;
142 } 148 }
143 } 149 }
144 cmd.ImportGraph.execute(filePath, includePaths, regexps, levels, options); 150 cmd.ImportGraph.execute(filePath, includePaths, regexps, levels, siStyle, piStyle, options);
145 break; 151 break;
146 case "stats", "statistics": 152 case "stats", "statistics":
147 char[][] filePaths; 153 char[][] filePaths;
148 bool printTokensTable; 154 bool printTokensTable;
149 bool printNodesTable; 155 bool printNodesTable;
305 break; 311 break;
306 case "gen", "generate": 312 case "gen", "generate":
307 msg = GetMsg(MID.HelpGenerate); 313 msg = GetMsg(MID.HelpGenerate);
308 break; 314 break;
309 case "importgraph", "igraph": 315 case "importgraph", "igraph":
310 msg = GetMsg(MID.HelpImportGraph); 316 // msg = GetMsg(MID.HelpImportGraph);
317 msg = `Parse a module and build a module dependency graph based on its imports.
318 Usage:
319 dil igraph file.d Format [Options]
320
321 The directory of file.d is implicitly added to the list of import paths.
322
323 Format:
324 --dot : generate a dot document
325 Options related to --dot:
326 -gbp : Group modules by package names
327 -gbf : Group modules by full package name
328 -hle : highlight cyclic edges in the graph
329 -hlv : highlight modules in cyclic relationships
330 -siSTYLE : the edge style to use for static imports
331 -piSTYLE : the edge style to use for public imports
332 STYLE can be: "dashed", "dotted", "solid", "invis" or "bold"
333
334 --paths : print the file paths of the modules in the graph
335
336 --list : print the names of the module in the graph
337 Options common to --paths and --list:
338 -lN : print N levels.
339 -m : use '*' to mark modules in cyclic relationships
340
341 Options:
342 -Ipath : add 'path' to the list of import paths where modules are
343 looked for
344 -rREGEXP : exclude modules whose names match the regular expression
345 REGEXP
346 -i : include unlocatable modules
347
348 Example:
349 dil igraph src/main.d`;
311 break; 350 break;
312 case "tok", "tokenize": 351 case "tok", "tokenize":
313 msg = `Print the tokens of a D source file. 352 msg = `Print the tokens of a D source file.
314 Usage: 353 Usage:
315 dil tok file.d [Options] 354 dil tok file.d [Options]