forked from drogonframework/drogon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cc
executable file
·49 lines (45 loc) · 876 Bytes
/
main.cc
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
/**
*
* @file main.cc
* @author An Tao
*
* Copyright 2018, An Tao. All rights reserved.
* https://github.com/an-tao/drogon
* Use of this source code is governed by a MIT license
* that can be found in the License file.
*
* Drogon
*
*/
#include "cmd.h"
#include <string>
#include <vector>
#include <iostream>
int main(int argc, char *argv[])
{
std::vector<std::string> args;
if (argc < 2)
{
args = {"help"};
exeCommand(args);
return 0;
}
for (int i = 1; i < argc; ++i)
{
args.push_back(argv[i]);
}
if (args.size() > 0)
{
auto &arg = args[0];
if (arg == "-h" || arg == "--help")
{
arg = "help";
}
else if (arg == "-v" || arg == "--version")
{
arg = "version";
}
}
exeCommand(args);
return 0;
}