Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 13, 2024

Conversation

Toni500github
Copy link
Contributor

@Toni500github Toni500github commented Oct 11, 2024

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
Copy link
Contributor Author

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

Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also if you could split those into 3 commits:

  • hyprland
  • hyprpm
  • hyprctl

then I could just rebase it on main.

@vaxerski
Copy link
Member

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

ye thats whatever both look alr

@Toni500github
Copy link
Contributor Author

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?

@vaxerski
Copy link
Member

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

@Toni500github
Copy link
Contributor Author

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
Copy link
Contributor Author

btw bump VERSION to 0.44.1

@vaxerski
Copy link
Member

btw bump VERSION to 0.44.1

no

@Toni500github
Copy link
Contributor Author

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

@Toni500github
Copy link
Contributor Author

Toni500github commented Oct 13, 2024

image

image

also fixed some status printing generally

Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm thanks!

@vaxerski
Copy link
Member

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

@Toni500github
Copy link
Contributor Author

yeah ofc, was just waiting for approval

@vaxerski vaxerski merged commit 05a5e0b into hyprwm:main Oct 13, 2024
12 checks passed
@Toni500github
Copy link
Contributor Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants