diff --git a/CheckTool/README.md b/CheckTool/README.md index ff4ac2bb..74bed648 100644 --- a/CheckTool/README.md +++ b/CheckTool/README.md @@ -23,7 +23,7 @@ available [here][checktool-release]. ### Usage 1. `cd X:\path\to\CheckTool` -1. `checktool.exe --verbose` +1. `checktool.exe` The output will be as below. @@ -98,7 +98,7 @@ be omitted. ### Usage 1. `cd /path/to/CheckTool` -1. `./checktool --verbose` +1. `./checktool` ### Build @@ -126,7 +126,7 @@ below. | `cmake -DCMAKE_BUILD_TYPE=Release -B build/Release` | `make -C build/Release` -[checktool-release]: https://github.com/intel/haxm/releases/tag/checktool-v1.0.0 +[checktool-release]: https://github.com/intel/haxm/releases/tag/checktool-v1.1.0 [cmake]: https://cmake.org/download/ [install-on-macos]: https://github.com/intel/haxm/wiki/Installation-Instructions-on-macOS diff --git a/CheckTool/common.cpp b/CheckTool/common.cpp index 1c80dd22..74dff6bf 100644 --- a/CheckTool/common.cpp +++ b/CheckTool/common.cpp @@ -37,33 +37,37 @@ namespace haxm { namespace check_util { -CheckResult ParseArguments(int &argc, char* argv[], bool &is_verbose) { - haxm::check_util::ArgParser arg_parser(argc, argv, {"-h", "--help", "-v", - "--verbose"}); +CheckResult ParseArguments(int &argc, char* argv[]) { + CheckResult res = kPass; + ArgParser arg_parser(argc, argv, {"-h", "--help", "-v", "--version"}); if (!arg_parser.Verify()) { std::cout << "checktool unknown option: " << arg_parser.error() << std::endl; - std::cout << "Usage: checktool [-h | --help] [-v | --verbose]" + std::cout << "Usage: checktool [-h | --help] [-v | --version]" << std::endl; - return haxm::check_util::kError; + return kError; } - if (arg_parser.Test("-h") || arg_parser.Test("--help")) { - std::cout << "CheckTool version " << APP_VERSION << std::endl; - std::cout << "-v, --verbose Show detailed system information" - << std::endl; - return haxm::check_util::kFail; + if (arg_parser.Test("-v") || arg_parser.Test("--version")) { + std::cout << "checktool " << APP_VERSION << std::endl; + std::cout << APP_COPYRIGHT << std::endl; + + res = kFail; } - if (arg_parser.Test("-v") || arg_parser.Test("--verbose")) { - is_verbose = true; + if (arg_parser.Test("-h") || arg_parser.Test("--help")) { + std::cout << "Usage: checktool [-v | --version]" << std::endl; + std::cout << "Check system environment for HAXM." << std::endl; + std::cout << "'*' means passed, while '-' means failed." << std::endl; + + res = kFail; } - return haxm::check_util::kPass; + return res; } -int Check(bool is_verbose) { +int Check() { int ret = 0; haxm::check_util::FeatureDetector fd; @@ -75,9 +79,7 @@ int Check(bool is_verbose) { ret = 1; } - if (is_verbose) { - fd.Print(); - } + fd.Print(); return ret; } diff --git a/CheckTool/common.h b/CheckTool/common.h index 5b21c1ce..e3baa420 100644 --- a/CheckTool/common.h +++ b/CheckTool/common.h @@ -36,7 +36,8 @@ namespace haxm { namespace check_util { -#define APP_VERSION "1.0.0" +#define APP_VERSION "1.1.0" +#define APP_COPYRIGHT "Copyright (C) 2020 Intel Corporation" enum CheckResult { kUnknown = 0, @@ -52,8 +53,8 @@ inline static bool IsBitSet(uint32_t reg, int bit) { return (reg >> bit) & 0x1; } -CheckResult ParseArguments(int &argc, char* argv[], bool &is_verbose); -int Check(bool is_verbose); +CheckResult ParseArguments(int &argc, char* argv[]); +int Check(); } // namespace check_util } // namespace haxm diff --git a/CheckTool/main.cpp b/CheckTool/main.cpp index 7b1849fc..4697be88 100644 --- a/CheckTool/main.cpp +++ b/CheckTool/main.cpp @@ -32,18 +32,14 @@ int main(int argc, char* argv[]) { int ret = 0; - haxm::check_util::CheckResult result; - bool is_verbose = false; - result = haxm::check_util::ParseArguments(argc, argv, is_verbose); - - switch (result) { + switch (haxm::check_util::ParseArguments(argc, argv)) { case haxm::check_util::kPass: { - ret = haxm::check_util::Check(is_verbose); + ret = haxm::check_util::Check(); break; } case haxm::check_util::kError: { - ret = -1; + ret = 1; break; } default: {