drogon/drogon_ctl/main.cc
An Tao 58702dc41e
Port drogon to Windows (#335)
Co-authored-by: mcirsta <mforce2@gmail.com>
2020-01-25 11:58:20 +08:00

50 lines
887 B
C++
Executable File

/**
*
* main.cc
* 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[])
{
if (argc < 2)
{
std::vector<std::string> args = {"help"};
exeCommand(args);
return 0;
}
std::vector<std::string> args;
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;
}