Skip to content

London | 26-JUL-SDC | Ping Wang | Sprint 3 | Implement- shell- tools#585

Open
pathywang wants to merge 8 commits into
CodeYourFuture:mainfrom
pathywang:implement-shell-tools
Open

London | 26-JUL-SDC | Ping Wang | Sprint 3 | Implement- shell- tools#585
pathywang wants to merge 8 commits into
CodeYourFuture:mainfrom
pathywang:implement-shell-tools

Conversation

@pathywang

Copy link
Copy Markdown

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

After i completed prep, created branch from main branch and felt the coursework is getting really hard because unable to get too much clue from prep so get lots of help and explanation from AL and review again in order to full understand knowledge

@pathywang pathywang added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 17, 2026
@pathywang pathywang added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jul 19, 2026

@SlideGauge SlideGauge left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good job, could you address a couple of notes from me?

console.log(output.join(" "));
}

for (const file of files) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Run the real wc sample-files/* with several files — what extra line appears at the bottom that yours doesn't produce? Where in this loop could you accumulate the counts to print it?

}

function countFile(filename) {
const content = fs.readFileSync(filename, "utf8");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

your ls example wraps the file access in try/catch block. Do we need the same block here?


for (const file of files) {
const content = fs.readFileSync(file, "utf8");
const lines = content.split("\n");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If a file ends in \n, what is the last element of content.split("\n")? Combined with console.log adding its own newline, how does cat sample-files/1.txt compare to the real output — same lines, or one extra blank?

let lineNumber = 1;

for (const file of files) {
const content = fs.readFileSync(file, "utf8");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do we need to guard this block in similar manner to ls?

@SlideGauge SlideGauge 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. labels Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants