summaryrefslogtreecommitdiff
path: root/hyprpm/src/helpers/StringUtils.hpp
blob: c1a5fd989632b221fec76f9b440f4a20f4e6f3a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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...);
}