From 40c26f01e4b1360c9d9b7b8ab299642fb7ea3d8f Mon Sep 17 00:00:00 2001 From: antao Date: Sat, 22 Jun 2019 21:51:14 +0800 Subject: [PATCH] Modify the parameters of drogon_ctl command --- .travis.yml | 1 + drogon_ctl/help.cc | 3 ++- drogon_ctl/main.cc | 11 +++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cacaf80b..cc4d459d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,6 +38,7 @@ addons: - postgresql - mariadb - sqlite3 + update: true script: - ./build.sh && ./test.sh diff --git a/drogon_ctl/help.cc b/drogon_ctl/help.cc index 59759964..cf4e59d6 100644 --- a/drogon_ctl/help.cc +++ b/drogon_ctl/help.cc @@ -21,7 +21,8 @@ void help::handleCommand(std::vector ¶meters) { if (parameters.size() == 0) { - std::cout << "usage: drogon_ctl []" << std::endl; + std::cout << "usage: drogon_ctl [-v | --version] [-h | --help] []" + << std::endl; std::cout << "commands list:" << std::endl; for (auto &className : drogon::DrClassMap::getAllClassName()) { diff --git a/drogon_ctl/main.cc b/drogon_ctl/main.cc index c8907ea6..6aefc5cc 100755 --- a/drogon_ctl/main.cc +++ b/drogon_ctl/main.cc @@ -31,6 +31,17 @@ int main(int argc, char *argv[]) { args.push_back(argv[i]); } + for (auto &arg : args) + { + if (arg == "-h" || arg == "--help") + { + arg = "help"; + } + else if (arg == "-v" || arg == "--version") + { + arg = "version"; + } + } exeCommand(args);