diff --git a/include/cmd_parser.h b/include/cmd_parser.h index 0702e66..ff6dcaf 100644 --- a/include/cmd_parser.h +++ b/include/cmd_parser.h @@ -75,6 +75,7 @@ private: uint32_t AddAppend(const std::string& argValue); uint32_t SetCombine(); uint32_t AddDependEntry(const std::string& argValue); + uint32_t ShowHelp() const; bool IsAscii(const std::string& argValue) const; static const struct option CMD_OPTS[]; @@ -128,6 +129,7 @@ void CmdParser::ShowUseage() std::cout << " -e start id mask, e.g 0x01000000, in [0x01000000, 0x06FFFFFF),[0x08000000, 0x41FFFFFF)\n"; std::cout << " -x resources folder path\n"; std::cout << " -z flag for incremental compilation\n"; + std::cout << " -h Displays this help menu\n"; } template diff --git a/src/cmd_parser.cpp b/src/cmd_parser.cpp index e7522f8..e4093d9 100644 --- a/src/cmd_parser.cpp +++ b/src/cmd_parser.cpp @@ -39,9 +39,10 @@ const struct option PackageParser::CMD_OPTS[] = { { "append", required_argument, nullptr, 'x' }, { "combine", required_argument, nullptr, 'z' }, { "dependEntry", required_argument, nullptr, 'd' }, + { "help", no_argument, nullptr, 'h'}, }; -const string PackageParser::CMD_PARAMS = "i:p:o:r:m:j:e:c:l:g:x:d:afvz"; +const string PackageParser::CMD_PARAMS = "i:p:o:r:m:j:e:c:l:g:x:d:afhvz"; uint32_t PackageParser::Parse(int argc, char *argv[]) { @@ -320,6 +321,14 @@ uint32_t PackageParser::AddDependEntry(const string& argValue) return RESTOOL_SUCCESS; } +uint32_t PackageParser::ShowHelp() const +{ + auto &parser = CmdParser::GetInstance(); + parser.ShowUseage(); + exit(RESTOOL_SUCCESS); + return RESTOOL_SUCCESS; +} + bool PackageParser::IsAscii(const string& argValue) const { #ifdef __WIN32 @@ -355,6 +364,7 @@ void PackageParser::InitCommand() handles_.emplace('x', bind(&PackageParser::AddAppend, this, _1)); handles_.emplace('z', [this](const string &) -> uint32_t { return SetCombine(); }); handles_.emplace('d', bind(&PackageParser::AddDependEntry, this, _1)); + handles_.emplace('h', [this](const string &) -> uint32_t { return ShowHelp(); }); } uint32_t PackageParser::HandleProcess(int c, const string& argValue) diff --git a/src/json_compiler.cpp b/src/json_compiler.cpp index 62cb683..f435bb6 100644 --- a/src/json_compiler.cpp +++ b/src/json_compiler.cpp @@ -302,7 +302,7 @@ bool JsonCompiler::CheckJsonStringValue(const Json::Value &valueNode, const Reso ResType type = resourceItem.GetResType(); if (type == ResType::COLOR && !CheckColorValue(value.c_str())) { string error = "invaild color value '" + value + \ - "', only support refer '$color:xxx' or '#rgb','#argb','#rrggbb','aarrggbb'."; + "', only support refer '$color:xxx' or '#rgb','#argb','#rrggbb','#aarrggbb'."; cerr << "Error: " << error << NEW_LINE_PATH << resourceItem.GetFilePath() << endl; return false; }