-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathmain.cpp
More file actions
60 lines (49 loc) · 1.25 KB
/
Copy pathmain.cpp
File metadata and controls
60 lines (49 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <iostream>
#include <io.h>
#include <fcntl.h>
#include "NodeRegistry.hpp"
#include "CLICommand.hpp"
#include "OpenExportCommand.hpp"
#ifdef DEBUG
#pragma comment(lib, "NodeEngineDebug.lib")
#pragma comment(lib, "NodeUIEngineDebug.lib")
#pragma comment(lib, "BuiltInNodesDebug.lib")
#else
#pragma comment(lib, "NodeEngine.lib")
#pragma comment(lib, "NodeUIEngine.lib")
#pragma comment(lib, "BuiltInNodes.lib")
#endif
void PrintUsage ()
{
std::wcout << "Usage: VisualScriptCADCLI <command> [parameters]" << std::endl;
}
int wmain (int argc, wchar_t* argv[])
{
// make sure every node is statically initialized
GetNodeRegistry ();
_setmode (_fileno (stdout), _O_WTEXT);
if (argc < 2) {
PrintUsage ();
return 1;
}
CLI::CommandHandler commandHandler;
commandHandler.RegisterCommand (CLI::CommandPtr (new OpenExportCommand ()));
std::wstring commandName = argv[1];
CLI::CommandPtr command = commandHandler.GetCommand (commandName);
if (command == nullptr) {
PrintUsage ();
return 1;
}
std::vector<std::wstring> parameters;
for (int i = 2; i < argc; i++) {
parameters.push_back (argv[i]);
}
if (command->GetParameterCount () != parameters.size ()) {
PrintUsage ();
return 1;
}
if (!command->Do (parameters)) {
return 1;
}
return 0;
}