diff --git a/include/poac/util.hpp b/include/poac/util.hpp index a69b74884..99fd6f3b5 100644 --- a/include/poac/util.hpp +++ b/include/poac/util.hpp @@ -12,49 +12,4 @@ #include #include -#include -#include - -namespace poac::util { - -constexpr bool -is_digit(const char& c) noexcept { - return '0' <= c && c <= '9'; -} - -constexpr bool -is_alphabet(const char& c) noexcept { - return ('A' <= c && c <= 'Z') - || ('a' <= c && c <= 'z'); -} - -constexpr bool -is_alpha_numeric(const char& c) noexcept { - return is_digit(c) || is_alphabet(c); -} - -/// Check the base requirements for a package name. -/// -/// This can be used for other things than package names, to enforce some -/// level of sanity. Note that package names have other restrictions -/// elsewhere. `poac new` has a few restrictions, such as checking for -/// reserved names. poac.pm has even more restrictions. -void -validate_package_name(std::string_view name, std::string_view what, std::string_view help) { - for (const auto& c : name) { - if (!is_alpha_numeric(c) && c != '_' && c != '-') { - throw core::except::error( - "Invalid character `", c, "` in ", what, ": `", name, "`", help); - } - } -} - -/// Whether or not this running in a Continuous Integration environment. -bool -is_ci() { - return (std::getenv("CI") != nullptr) || (std::getenv("TF_BUILD") != nullptr); -} - -} // namespace poac::util - #endif // !POAC_UTIL_HPP