Rename the Yerbacon::exit function to Yerbacon::fail

Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
Username404 2022-02-08 19:26:57 +01:00
parent de2259b6ed
commit beb28ef4ad
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
3 changed files with 5 additions and 5 deletions

View File

@ -44,14 +44,14 @@ namespace Yerbacon {
" Compiler: " YBCON_COMPILER "\n" " Compiler: " YBCON_COMPILER "\n"
" C++ standard: " make_string(__cplusplus); " C++ standard: " make_string(__cplusplus);
} }
static void exit(const std::initializer_list<const char*> reason) { static void fail(const std::initializer_list<const char*> reason) {
std::for_each(reason.begin(), reason.end(), [](const char* current_string){ std::for_each(reason.begin(), reason.end(), [](const char* current_string){
std::cout << current_string; std::cout << current_string;
}); });
std::cout << std::endl; std::cout << std::endl;
std::exit(EXIT_FAILURE); std::exit(EXIT_FAILURE);
} }
inline void exit(const char* reason) { exit({reason}); } inline void fail(const char* reason) { fail({reason}); }
class Exception: public std::exception { class Exception: public std::exception {
std::string exceptionCause; std::string exceptionCause;
public: public:

View File

@ -157,7 +157,7 @@ shared_ptr<Target> Target::forName(string_view name, const bool newLines = true)
case PY: ADDTARGET(PY_HPP); break; case PY: ADDTARGET(PY_HPP); break;
#endif #endif
case NONE: case NONE:
default: Yerbacon::exit({"\"", string(1, (char) toupper(name.at(1))).data(), name.substr(2).data(), "\" is not a valid target."}); default: Yerbacon::fail({"\"", string(1, (char) toupper(name.at(1))).data(), name.substr(2).data(), "\" is not a valid target."});
} }
#undef ADDTARGET #undef ADDTARGET
#undef make_nonlocal_task #undef make_nonlocal_task

View File

@ -23,7 +23,7 @@ int main(int argc, char* argv[]) {
else if (currentArg == ArgumentAssignable("target")) { else if (currentArg == ArgumentAssignable("target")) {
const string_view value = ArgumentAssignable::getValueFor(currentArg); const string_view value = ArgumentAssignable::getValueFor(currentArg);
if (not value.empty()) (target = '.') += value; if (not value.empty()) (target = '.') += value;
else Yerbacon::exit("No target was provided."); else Yerbacon::fail("No target was provided.");
} }
else if (currentArg == Argument("parallel")) parallel = true; else if (currentArg == Argument("parallel")) parallel = true;
else if (currentArg == ArgumentAssignable("newlines")) { else if (currentArg == ArgumentAssignable("newlines")) {
@ -43,7 +43,7 @@ int main(int argc, char* argv[]) {
cout << Yerbacon::getBuildInfo(); cout << Yerbacon::getBuildInfo();
} else goto invalid_argument; } else goto invalid_argument;
cout << '\n'; exit(EXIT_SUCCESS); cout << '\n'; exit(EXIT_SUCCESS);
} else invalid_argument: Yerbacon::exit({"\"", currentArg.data(), "\" is not a valid argument."}); } else invalid_argument: Yerbacon::fail({"\"", currentArg.data(), "\" is not a valid argument."});
} }
} }
const auto currentTarget = Target::forName(target, newLines); const auto currentTarget = Target::forName(target, newLines);