Skip to content

Commit

Permalink
println -> fmt::println
Browse files Browse the repository at this point in the history
  • Loading branch information
aristocratos committed May 21, 2023
1 parent fbc349d commit b0fc635
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/btop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void argumentParser(const int& argc, char **argv) {
for(int i = 1; i < argc; i++) {
const string argument = argv[i];
if (is_in(argument, "-h", "--help")) {
println(
fmt::println(
"usage: btop [-h] [-v] [-/+t] [-p <id>] [--utf-force] [--debug]\n\n"
"optional arguments:\n"
" -h, --help show this help message and exit\n"
Expand All @@ -129,7 +129,7 @@ void argumentParser(const int& argc, char **argv) {
exit(0);
}
else if (is_in(argument, "-v", "--version")) {
println("btop version: {}", Global::Version);
fmt::println("btop version: {}", Global::Version);
exit(0);
}
else if (is_in(argument, "-lc", "--low-color")) {
Expand All @@ -145,14 +145,14 @@ void argumentParser(const int& argc, char **argv) {
}
else if (is_in(argument, "-p", "--preset")) {
if (++i >= argc) {
println("ERROR: Preset option needs an argument.");
fmt::println("ERROR: Preset option needs an argument.");
exit(1);
}
else if (const string val = argv[i]; isint(val) and val.size() == 1) {
Global::arg_preset = std::clamp(stoi(val), 0, 9);
}
else {
println("ERROR: Preset option only accepts an integer value between 0-9.");
fmt::println("ERROR: Preset option only accepts an integer value between 0-9.");
exit(1);
}
}
Expand All @@ -161,7 +161,7 @@ void argumentParser(const int& argc, char **argv) {
else if (argument == "--debug")
Global::debug = true;
else {
println(" Unknown argument: {}\n"
fmt::println(" Unknown argument: {}\n"
" Use -h or --help for help.", argument);
exit(1);
}
Expand Down Expand Up @@ -266,7 +266,7 @@ void clean_quit(int sig) {
if (not Global::exit_error_msg.empty()) {
sig = 1;
Logger::error(Global::exit_error_msg);
println(std::cerr, "{}ERROR: {}{}{}", Global::fg_red, Global::fg_white, Global::exit_error_msg, Fx::reset);
fmt::println(std::cerr, "{}ERROR: {}{}{}", Global::fg_red, Global::fg_white, Global::exit_error_msg, Fx::reset);
}
Logger::info("Quitting! Runtime: " + sec_to_dhms(time_s() - Global::start_time));

Expand Down Expand Up @@ -760,12 +760,12 @@ int main(int argc, char **argv) {
}
}
if (Config::conf_dir.empty()) {
println("WARNING: Could not get path user HOME folder.\n"
fmt::println("WARNING: Could not get path user HOME folder.\n"
"Make sure $XDG_CONFIG_HOME or $HOME environment variables is correctly set to fix this.");
}
else {
if (std::error_code ec; not fs::is_directory(Config::conf_dir) and not fs::create_directories(Config::conf_dir, ec)) {
println("WARNING: Could not create or access btop config directory. Logging and config saving disabled.\n"
fmt::println("WARNING: Could not create or access btop config directory. Logging and config saving disabled.\n"
"Make sure $XDG_CONFIG_HOME or $HOME environment variables is correctly set to fix this.");
}
else {
Expand Down

0 comments on commit b0fc635

Please sign in to comment.