diff options
| author | Toni500git <toni500minecraft@gmail.com> | 2024-10-13 14:23:33 +0200 |
|---|---|---|
| committer | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2024-10-13 14:13:56 +0100 |
| commit | e79d3cd2ef5632e2e6b3b20fd0b5dc4d2843f956 (patch) | |
| tree | d50b2fa8ed8f5e4d6703af4d6804e0735bea70e0 /hyprpm/src/helpers/StringUtils.hpp | |
| parent | 1822707c7e7394ce8c7572f2fe890763a307f499 (diff) | |
hyprpm: convert std::cout and std::cerr to std::println()
Diffstat (limited to 'hyprpm/src/helpers/StringUtils.hpp')
| -rw-r--r-- | hyprpm/src/helpers/StringUtils.hpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/hyprpm/src/helpers/StringUtils.hpp b/hyprpm/src/helpers/StringUtils.hpp new file mode 100644 index 00000000..c1a5fd98 --- /dev/null +++ b/hyprpm/src/helpers/StringUtils.hpp @@ -0,0 +1,32 @@ +#pragma once + +#include <format> +#include <string> +#include "Colors.hpp" + +template <typename... Args> +std::string statusString(const std::string_view emoji, const std::string_view color, const std::string_view fmt, Args&&... args) { + std::string ret = std::format("{}{}{} ", color, emoji, Colors::RESET); + ret += std::vformat(fmt, std::make_format_args(args...)); + return ret; +} + +template <typename... Args> +std::string successString(const std::string_view fmt, Args&&... args) { + return statusString("✔", Colors::GREEN, fmt, args...); +} + +template <typename... Args> +std::string failureString(const std::string_view fmt, Args&&... args) { + return statusString("✖", Colors::RED, fmt, args...); +} + +template <typename... Args> +std::string verboseString(const std::string_view fmt, Args&&... args) { + return statusString("[v]", Colors::BLUE, fmt, args...); +} + +template <typename... Args> +std::string infoString(const std::string_view fmt, Args&&... args) { + return statusString("→", Colors::RESET, fmt, args...); +} |
