Skip to content

Conversation

@sheetalkharab
Copy link

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

add code for cat wc and ls

Questions

Ask any questions you have for your reviewer.

@sheetalkharab sheetalkharab added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 29, 2025
@LonMcGregor LonMcGregor added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Aug 12, 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.

Great start with these tasks. I've left some comments on your files for where you could improve them more.


for (const path of argv) {
try {
const content = await fs.readFile(path, "utf-8");

Choose a reason for hiding this comment

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

Be careful of the indentation here - try to make it consistent across a file.

Copy link
Author

Choose a reason for hiding this comment

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

@LonMcGregor thank you for review and added the extension for indentation checking .

if (line.trim() === "") {
console.log(""); // Blank line, no number
} else {
const lineNumber = String(lineCounter++).padStart(6, " ");

Choose a reason for hiding this comment

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

You duplicating your code a bit when printing out with line numbers, can you think of a way to reduce this duplication?

Copy link
Author

Choose a reason for hiding this comment

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

I tried to use a function to remove duplication of code.


if (files.length > 1) {
if (options.lines) {
console.log(`${totalLines} total`)//if more then 1 file is

Choose a reason for hiding this comment

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

There is some duplication when you are printing out your total and counts. Can you think how to reduce that?

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 . try to make change as you suggested.

@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 12, 2025
@sheetalkharab sheetalkharab added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 14, 2025
@LonMcGregor
Copy link

Great work on reducing duplication - your wc implementation in particular is much easier to read now.

Further testing with your cat implementation reveals a problem with how it is handling some of the program options. Have you fully tested these / compared them to the original cat program?

@LonMcGregor LonMcGregor removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 18, 2025
@sheetalkharab sheetalkharab added the Complete Volunteer to add when work is complete and all review comments have been addressed. label Oct 16, 2025
@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

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. Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

01 Implement shell tools (cat, ls, wc) in JavaScript with NodeJS

2 participants