MCPcopy Create free account
hub / github.com/Gusabary/FlowChar / parseArg

Function parseArg

src/main.cpp:32–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32ArgInfo parseArg(int argc, char **argv) {
33 // -c <path>, specify path of code to be parsed, required.
34 // -o <path>, specify path of chart to be emitted, optional. If absent, print to stdout.
35
36 if (argc == 3 && !strcmp(argv[1], "-c")) {
37 // must be -c
38 return ArgInfo(argv[2]);
39 }
40
41 if (argc == 5) {
42 // both -c and -o
43 if (!strcmp(argv[1], "-c") && !strcmp(argv[3], "-o"))
44 return ArgInfo(argv[2], argv[4]);
45 if (!strcmp(argv[3], "-c") && !strcmp(argv[1], "-o"))
46 return ArgInfo(argv[4], argv[2]);
47 }
48
49 // illegal arguments, print help info
50 printHelp();
51 exit(0);
52}
53
54int main(int argc, char **argv)
55{

Callers 1

mainFunction · 0.85

Calls 2

ArgInfoClass · 0.85
printHelpFunction · 0.85

Tested by

no test coverage detected