Skip to content

cat: Add the -n line numbering feature #24382

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 1 commit into from
Jul 12, 2024
Merged

Conversation

PerrinJS
Copy link
Contributor

Adds the -n line numbering feature to cat, with the same formatting as gnu's cat function.

@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label May 19, 2024
Copy link
Member

@LucasChollet LucasChollet left a comment

Choose a reason for hiding this comment

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

Welcome to the project!

It doesn't really matter, but you can put the function in an anonymous namespace above the main to avoid having a declaration.

And also, it feels like output_buffer_with_line_numbers can be written in a simpler way. Feel free to try something on that side, otherwise I will give it a shot on a future review.

@nico nico added ⏳ pr-waiting-for-author PR is blocked by feedback / code changes from the author and removed 👀 pr-needs-review PR needs review from a maintainer or community member labels Jun 11, 2024
@github-actions github-actions bot added 👀 pr-needs-review PR needs review from a maintainer or community member and removed ⏳ pr-waiting-for-author PR is blocked by feedback / code changes from the author labels Jun 13, 2024
@PerrinJS PerrinJS requested a review from LucasChollet June 19, 2024 11:29
Copy link
Member

@LucasChollet LucasChollet left a comment

Choose a reason for hiding this comment

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

One small nitpick, otherwise LGTM!

@nico nico added ⏳ pr-waiting-for-author PR is blocked by feedback / code changes from the author and removed 👀 pr-needs-review PR needs review from a maintainer or community member labels Jun 27, 2024
@github-actions github-actions bot added 👀 pr-needs-review PR needs review from a maintainer or community member and removed ⏳ pr-waiting-for-author PR is blocked by feedback / code changes from the author labels Jul 3, 2024
@PerrinJS PerrinJS requested a review from alimpfard July 3, 2024 12:43
@nico nico added ⏳ pr-waiting-for-author PR is blocked by feedback / code changes from the author and removed 👀 pr-needs-review PR needs review from a maintainer or community member labels Jul 4, 2024
@github-actions github-actions bot added 👀 pr-needs-review PR needs review from a maintainer or community member and removed ⏳ pr-waiting-for-author PR is blocked by feedback / code changes from the author labels Jul 11, 2024
@PerrinJS
Copy link
Contributor Author

Please disregard the changes prior to this as it still does not contain the updates. Thank you for bearing with me.

Adds the -n line numbering feature with the same formatting as gnu's cat
function.
@LucasChollet LucasChollet removed the 👀 pr-needs-review PR needs review from a maintainer or community member label Jul 11, 2024
@LucasChollet LucasChollet added the ✅ pr-community-approved PR has been approved by a community member label Jul 11, 2024
@@ -11,15 +11,36 @@
#include <LibCore/System.h>
#include <LibMain/Main.h>

struct LineTracker {
size_t line_count = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

fyi: size_t line_count { 1 }; is what we use in most other places. I'll merge this, but if you end up touching this file again, maybe you could fix it up then.

@nico nico merged commit f30dc92 into SerenityOS:master Jul 12, 2024
14 checks passed
@nico
Copy link
Contributor

nico commented Jul 12, 2024

Thanks!

@github-actions github-actions bot removed the ✅ pr-community-approved PR has been approved by a community member label Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants