Hyprland icon indicating copy to clipboard operation
Hyprland copied to clipboard

convert std::cout and std::cerr to std::println()

Open Toni500github opened this issue 1 year ago • 2 comments

Describe your PR, what does it fix/add?

follow up from #8034 std::print() is easier to use and read, it also has better performance and reduces boilerplate code https://vitaut.net/posts/2023/print-in-cpp23/

Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

So I have almost converted every instance of std::cout, I only left some for example where hyprpm prints the warning message when adding a plugin and there were too many Colors, so I left those for the sake of readability.

I have added hyprpm/src/helpers/StringUtils.hpp which is useful to replace the boilerplate such as

std::cout << Colors::BLUE << "[v] " << Colors::RESET << "version returned: " << HLVERCALL << "\n";

with

std::println("{}", verboseString("version returned: {}", HLVERCALL));

Is it ready for merging, or does it need work?

Yeah, hope I didn't do too much or some things must be in a separeted MR. This took me the whole day. Did some tests and seems good so far

Toni500github avatar Oct 11 '24 20:10 Toni500github

is the indetion good? 1st: current, 2nd: my MR image

Toni500github avatar Oct 11 '24 20:10 Toni500github

is the indetion good? 1st: current, 2nd: my MR

ye thats whatever both look alr

vaxerski avatar Oct 11 '24 22:10 vaxerski

also if you could split those into 3 commits:

  • hyprland
  • hyprpm
  • hyprctl

then I could just rebase it on main.

Sorry wdym? Like re-creating these 5 commits in 3 and separated by categories?

Toni500github avatar Oct 12 '24 05:10 Toni500github

Sorry wdym? Like re-creating these 5 commits in 3 and separated by categories?

Squash all commits into one, then split that one commit into three, each changing only one component (hyprland, hyprctl, hyprpm)

so it's

  • hyprland: convert std::cout and std::cerr to std::println
  • hyprpm: convert std::cout and std::cerr to std::println
  • hyprctl: convert std::cout and std::cerr to std::println

vaxerski avatar Oct 12 '24 14:10 vaxerski

Sorry wdym? Like re-creating these 5 commits in 3 and separated by categories?

Squash all commits into one, then split that one commit into three, each changing only one component (hyprland, hyprctl, hyprpm)

so it's

  • hyprland: convert std::cout and std::cerr to std::println
  • hyprpm: convert std::cout and std::cerr to std::println
  • hyprctl: convert std::cout and std::cerr to std::println

done

Toni500github avatar Oct 12 '24 15:10 Toni500github

btw bump VERSION to 0.44.1

Toni500github avatar Oct 12 '24 21:10 Toni500github

btw bump VERSION to 0.44.1

no

vaxerski avatar Oct 12 '24 23:10 vaxerski

let me know if there is anything else I missed or should changes, so I can rebase into 3 commits again

Toni500github avatar Oct 13 '24 10:10 Toni500github

image

image

also fixed some status printing generally

Toni500github avatar Oct 13 '24 10:10 Toni500github

image can you squash those again so that there are only 3 commits :P

vaxerski avatar Oct 13 '24 12:10 vaxerski

yeah ofc, was just waiting for approval

Toni500github avatar Oct 13 '24 12:10 Toni500github

image

Toni500github avatar Oct 13 '24 13:10 Toni500github