| 24 | const char* help = "--help"; |
| 25 | |
| 26 | int main(int argc, char* argv[]) |
| 27 | { |
| 28 | auto start = chrono::high_resolution_clock::now(); |
| 29 | |
| 30 | // Parse arguments |
| 31 | ArgumentParser argparse(argc, argv); |
| 32 | argparse.addArgument().hint("path").help("Path to COLLADA document or directory to parse. If 'path' is a directory it is parsed for files with .DAE extension."); |
| 33 | argparse.addArgument(checkSchemaAuto).help("Regular XML schema validation."); |
| 34 | argparse.addArgument(checkSchema).numParameters(1).hint(0, "schema_path").help("Validate against arbitrary XML schema."); |
| 35 | argparse.addArgument(checkUniqueIds).help("Check that ids in documents are unique."); |
| 36 | argparse.addArgument(checkUniqueSids).help("Check that sids in documents are unique in their scope."); |
| 37 | argparse.addArgument(checkLinks).help("Check that URIs refer to valid files and/or elements."); |
| 38 | argparse.addArgument(recursive).help("Recursively parse directories. Ignored if 'path' is not a directory."); |
| 39 | argparse.addArgument(quiet).help("If set, no output is sent to standard out/err."); |
| 40 | argparse.addArgument(help).help("Display help."); |
| 41 | |
| 42 | bool argparse_ok = argparse.parseArguments(); |
| 43 | |
| 44 | if (argparse.findArgument(help)) { |
| 45 | cout << argparse.usage() << endl; |
| 46 | return 0; |
| 47 | } |
| 48 | |
| 49 | if (!argparse_ok) { |
| 50 | cerr << argparse.getParseError() << endl; |
| 51 | cout << argparse.usage() << endl; |
| 52 | return 1; |
| 53 | } |
| 54 | |
| 55 | bool muted = argparse.findArgument(quiet); |
| 56 | Log log(muted); |
| 57 | |
| 58 | string path = Path::GetAbsolutePath(argparse.findArgument(0).getValue<string>()); |
| 59 | |
| 60 | list<string> daePaths; |
| 61 | if (Path::IsDirectory(path)) |
| 62 | { |
| 63 | cout << "Listing COLLADA files..." << endl; |
| 64 | daePaths = Path::ListDaes(path, argparse.findArgument(recursive)); |
| 65 | } |
| 66 | else |
| 67 | { |
| 68 | daePaths.push_back(path); |
| 69 | } |
| 70 | |
| 71 | if (daePaths.size() == 0) |
| 72 | { |
| 73 | cout << "No DAE found." << endl; |
| 74 | return 0; |
| 75 | } |
| 76 | |
| 77 | DaeValidator validator(daePaths); |
| 78 | int result = 0; |
| 79 | |
| 80 | if (!argparse.findArgument(checkSchemaAuto) && |
| 81 | !argparse.findArgument(checkUniqueIds) && |
| 82 | !argparse.findArgument(checkUniqueSids) && |
| 83 | !argparse.findArgument(checkSchema) && |
nothing calls this directly
no test coverage detected