1 module tooling.app;
2 
3 import std.stdio;
4 
5 import tooling.CxxImplement;
6 import tooling.CxxMerge;
7 import tooling.CxxSortFunctions;
8 
9 int main(string[] args)
10 {
11   try
12   {
13 	if (args.length > 1)
14 	{
15 	  switch (args[1])
16 	  {
17 		case "implement":
18 		  return implementMain(args);
19 		case "merge":
20 		  return mergeMain(args);
21 		case "sort":
22 		  return sortFunctionsMain(args);
23 		default:
24 		  break;
25 	  }
26 	}
27   }
28   catch (Exception e)
29   {
30 	stderr.writeln(e.msg);
31 	return 1;
32   }
33 
34   printHelp();
35   return 0;
36 }
37 
38 /**
39  * Prints help message
40  */
41 void printHelp()
42 {
43   stdout.writeln(`
44 C++ tooling.
45 
46 Usage:
47 
48     tooling cmd [options]
49 
50 Commands:
51 
52     implement
53         Given a C++ header/source file pair, add missing stub functions to the source file
54     merge
55         Merge any number of C++ files into one, preserving the namespace structure
56     sort
57         Sort C++ functions by name, preserving the namespace structure of the file
58 
59 Options are command specific.
60 `);
61 }