Skip to content

Conversation

@AFatmaa
Copy link

@AFatmaa AFatmaa commented Jul 31, 2025

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

This pull request implements the cat, wc, and ls shell tools in JavaScript using NodeJS, as per the coursework instructions.

I tried to make them work like the real tools for the tasks given in the README.md files.

Questions

Ask any questions you have for your reviewer.

@AFatmaa AFatmaa added 📅 Sprint 3 Assigned during Sprint 3 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jul 31, 2025
@LonMcGregor LonMcGregor added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Aug 13, 2025
Copy link

@LonMcGregor LonMcGregor left a comment

Choose a reason for hiding this comment

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

Hi,

First, I notice you haven't updated the template in your pull request. when opening a new PR on github, remember to add in your own explanation in the text.

You have made a good start implementing the tasks. I have left some comments to point you towards how you could improve the more.


for (const line of content.split("\n")) {
if (options.n) {
console.log(`${lineNumber} ${line}`);

Choose a reason for hiding this comment

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

Can you think of a way to ensure that once a number increased by a factor of 10, it doesn't bump the text along? (i.e. 10 takes up 1 more character space than 9)

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for the feedback and your time. You're right, numbers like '10' took up more space and pushed the text. I've fixed this by using padStart, and I updated my code.

program
.name("my-ls")
.description("Reimplementation of the Unix `ls` command with -1 and -a options")
.option("-1", "list one file per line")

Choose a reason for hiding this comment

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

You have an option allowing one line per file. What does the user do if they dont want one line per file?

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the feedback! You're right. I updated the code so that if -1 is not passed, the files will now be shown in a single line, just like the default ls command.

let totalOutput = "";

if (options.l || options.w || options.c) {
if (options.l) totalOutput += `${totalLines} `;

Choose a reason for hiding this comment

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

There is a lot of duplicated code when you are printing out individual and total lines. Can you think how to reduce this?

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for the feedback! I extracted the output logic into a separate function to remove duplication. Let me know what you think 🙏

@LonMcGregor LonMcGregor added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Aug 13, 2025
@AFatmaa
Copy link
Author

AFatmaa commented Aug 17, 2025

Hi @LonMcGregor,
Thank you so much for your guidance and your time! I’ve updated the PR template with an explanation. I hadn’t realised I needed to fill it in before, but I’ll make sure to do it properly for future PRs. I’ve also updated my code based on your comments. Could you please check them when you have time? Thanks again! 🙏

@LonMcGregor
Copy link

Great work - thanks for making these changes. You are now done with this sprint task. You can close this now.

A tip - if you respond to my review and want code reviewed again, remember to add the "needs review" label back onto this PR.

@LonMcGregor LonMcGregor added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Aug 18, 2025
@AFatmaa
Copy link
Author

AFatmaa commented Aug 19, 2025

Thanks a lot for your review and the helpful tips, @LonMcGregor 🌸 I’ll make sure to add the needs review label next time when I want another review.

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

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants