Skip to content

London | 26-SDC-Nov | Alina Sofragiu | Sprint 3 | Implement shell tools - #719

Open
sofragiualina wants to merge 1 commit into
CodeYourFuture:mainfrom
sofragiualina:sprint3
Open

sofragiualina wants to merge 1 commit into
CodeYourFuture:mainfrom
sofragiualina:sprint3

Conversation

@sofragiualina

Copy link
Copy Markdown

…dling

Learners, PR Template

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

Task code

CYF-1150

Changelist

Completed by implementing cat, ls, and wc in JavaScript with Node.js. I used import and Node’s built-in parseArgs to handle command-line flags.

@sofragiualina sofragiualina 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. Module-Tools The name of the module. labels Dec 1, 2026
}

const lines = contents.toString("utf8").match(/[^\n]*\n|[^\n]+$/g) ?? [];
let lineNumber = 1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How should line numbering behave across two files that cat -n prints as one stream?

To "like" or "dislike" this comment, please follow this link

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The numbering should carry on across both files. If the first file doesn’t end with a newline, the second file’s text continues on the same numbered line.

allowPositionals: true,
});

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.

What does cat output when it receives no filenames, such as in a pipeline?

To "like" or "dislike" this comment, please follow this link

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

With no filenames, cat reads from standard input and prints what it receives. In a pipeline, that’s the output from the previous command. My version currently prints nothing because the file loop never runs.

console.log(`${formattedCounts} ${label}`);
}

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.

What counts does wc produce when it receives piped input without any filenames?

To "like" or "dislike" this comment, please follow this link

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

wc reads from standard input when I give it no filenames. By default it prints the line, word, and byte counts. My version prints nothing because the file loop never runs.

@cyf-ai-code-reviewer cyf-ai-code-reviewer Bot 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 Dec 1, 2026
@cyf-ai-code-reviewer

Copy link
Copy Markdown

The CYF AI review has left comments. It will only review a PR one time. When you have addressed these comments, please request review again and a volunteer will take a look.

@sofragiualina sofragiualina added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Tools The name of the module. Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant