Skip to content

Conversation

@Pezhman-Azizi
Copy link

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

Changelist

This PR adds JavaScript (NodeJS) implementations of the three shell tools required for the sprint: cat, ls, and wc.
Each tool is implemented in its own commit for clarity and easier review.

What's Included

cat.js

  • Prints the contents of one or more files
  • Supports basic usage and incremental flag handling
  • Matches the core behaviour of Unix cat

ls.js

  • Supports -1 (one entry per line)
  • Supports -a (show hidden files)
  • Uses fs.readdirSync() and simple filtering

wc.js

  • Supports counting lines, words, and bytes
  • Implements flags -l, -w, -c
  • Supports multiple files and prints a total line
  • Uses NodeJS fs for UTF-8 byte counting

📝 Notes

  • All tools behave as required in the sprint instructions
  • Each tool lives in its own folder (cat, ls, wc)
  • Each tool has its own clean commit for easier code review

@Pezhman-Azizi Pezhman-Azizi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Dec 12, 2025
@LonMcGregor LonMcGregor added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jan 21, 2026
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.

Good start on this sprint's tasks, I have spotted a few areas where you could improve code further

Your way of handling arguments works ok, but can you think of any downsides to managing your arguments by checking each one in the input arguments? Compare this approach which how you handled arguments in the python task. Which is better?

}

// Coursework only tests -1 variants, so enforce it clearly
if (!onePerLine) {

Choose a reason for hiding this comment

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

Is there a reason you only focus on -1 here?

return { lines, words, bytes };
}

function formatOutput(counts, fileName) {

Choose a reason for hiding this comment

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

Good idea to move this to its own function!

@LonMcGregor LonMcGregor added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Jan 21, 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