serenity
serenity copied to clipboard
cat: Add -b to number non-blank lines
This PR adds a -b option to the cat command to number non-blank lines:
This is one of two implementations I came up with. It most closely follows the approach of the existing implementation, where we set the flag whether we need to print out a line number at the end of the for loop then check the flag at the beginning of the next iteration for loop.
The other approach diverges fro this approach and opts for a state machine-based approach https://github.com/SerenityOS/serenity/pull/24918
I personally think this approach is more difficult to understand than the other state machine-based approach.
Hello!
One or more of the commit messages in this PR do not match the SerenityOS code submission policy, please check the lint_commits CI job for more details on which commits were flagged and why.
Please do not close this PR and open another, instead modify your commit message(s) with git commit --amend and force push those changes to update this PR.
@PerrinJS also tagging you over here 🙂
Tagging you over here @nico as well https://github.com/SerenityOS/serenity/pull/24918#issuecomment-2296557197
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!
This pull request has been closed because it has not had recent activity. Feel free to re-open if you wish to still contribute these changes. Thank you for your contributions!