2018-05-31 17:00:31 +08:00
|
|
|
/**
|
|
|
|
*
|
2018-12-07 15:50:18 +08:00
|
|
|
* main.cc
|
|
|
|
* An Tao
|
2018-05-31 17:00:31 +08:00
|
|
|
*
|
|
|
|
* Copyright 2018, An Tao. All rights reserved.
|
2018-12-07 15:50:18 +08:00
|
|
|
* https://github.com/an-tao/drogon
|
2018-05-31 17:00:31 +08:00
|
|
|
* Use of this source code is governed by a MIT license
|
|
|
|
* that can be found in the License file.
|
|
|
|
*
|
2018-11-16 13:26:14 +08:00
|
|
|
* Drogon
|
2018-12-07 15:50:18 +08:00
|
|
|
*
|
2018-05-31 17:00:31 +08:00
|
|
|
*/
|
2018-05-29 13:49:26 +08:00
|
|
|
|
|
|
|
#include "cmd.h"
|
2018-05-28 14:34:47 +08:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <iostream>
|
2018-05-29 13:49:26 +08:00
|
|
|
|
2018-10-14 15:56:54 +08:00
|
|
|
int main(int argc, char *argv[])
|
2018-05-28 14:34:47 +08:00
|
|
|
{
|
2018-10-14 15:56:54 +08:00
|
|
|
if (argc < 2)
|
2018-05-28 14:34:47 +08:00
|
|
|
{
|
2018-10-14 15:56:54 +08:00
|
|
|
std::vector<std::string> args = {"help"};
|
2018-05-30 17:44:09 +08:00
|
|
|
exeCommand(args);
|
2018-05-28 14:34:47 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2018-05-29 13:49:26 +08:00
|
|
|
std::vector<std::string> args;
|
2019-11-21 11:27:47 +08:00
|
|
|
for (int i = 1; i < argc; ++i)
|
2018-05-28 14:34:47 +08:00
|
|
|
{
|
2018-05-29 13:49:26 +08:00
|
|
|
args.push_back(argv[i]);
|
2018-05-28 14:34:47 +08:00
|
|
|
}
|
2019-06-26 17:58:25 +08:00
|
|
|
if (args.size() > 0)
|
2019-06-22 21:51:14 +08:00
|
|
|
{
|
2019-06-26 17:58:25 +08:00
|
|
|
auto &arg = args[0];
|
2019-06-22 21:51:14 +08:00
|
|
|
if (arg == "-h" || arg == "--help")
|
|
|
|
{
|
|
|
|
arg = "help";
|
|
|
|
}
|
|
|
|
else if (arg == "-v" || arg == "--version")
|
|
|
|
{
|
|
|
|
arg = "version";
|
|
|
|
}
|
|
|
|
}
|
2018-05-29 13:49:26 +08:00
|
|
|
|
|
|
|
exeCommand(args);
|
|
|
|
|
2018-05-28 14:34:47 +08:00
|
|
|
return 0;
|
2018-11-16 13:26:14 +08:00
|
|
|
}
|