Successfully fail when running cmkr subcommands

main
Duncan Ogilvie 2 years ago
parent 8b19441d34
commit 1fd18503cd

@ -7,5 +7,3 @@ const char *handle_args(int argc, char **argv);
} // namespace args } // namespace args
} // namespace cmkr } // namespace cmkr
const char *cmkr_args_handle_args(int, char **);

@ -37,17 +37,17 @@ const char *handle_args(int argc, char **argv) {
} else if (main_arg == "build") { } else if (main_arg == "build") {
auto ret = build::run(argc, argv); auto ret = build::run(argc, argv);
if (ret) if (ret)
return "CMake build error!"; throw std::runtime_error("CMake build failed!");
return "CMake build completed!"; return "CMake build completed!";
} else if (main_arg == "install") { } else if (main_arg == "install") {
auto ret = build::install(); auto ret = build::install();
if (ret) if (ret)
return "CMake install error!"; throw std::runtime_error("CMake install failed!");
return "CMake install completed!"; return "CMake install completed!";
} else if (main_arg == "clean") { } else if (main_arg == "clean") {
auto ret = build::clean(); auto ret = build::clean();
if (ret) if (ret)
return "CMake clean error!"; throw std::runtime_error("CMake clean failed!");
return "Cleaned build directory!"; return "Cleaned build directory!";
} else { } else {
throw std::runtime_error(cmkr::help::message()); throw std::runtime_error(cmkr::help::message());
@ -55,13 +55,3 @@ const char *handle_args(int argc, char **argv) {
} }
} // namespace args } // namespace args
} // namespace cmkr } // namespace cmkr
const char *cmkr_args_handle_args(int argc, char **argv) {
try {
return cmkr::args::handle_args(argc, argv);
} catch (const std::exception &e) {
return e.what();
} catch (...) {
return "Unknown error!";
}
}

Loading…
Cancel
Save