Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

London | SDC-Nov-25 | Pezhman Azizi | Sprint 3 | Implement shell tools (cat, ls, wc) In JavaScript With NodeJS#302

Open
Pezhman-Azizi wants to merge 3 commits intoCodeYourFuture:main from
Pezhman-Azizi:implement-shell-tools-js
Open

London | SDC-Nov-25 | Pezhman Azizi | Sprint 3 | Implement shell tools (cat, ls, wc) In JavaScript With NodeJS #302
Pezhman-Azizi wants to merge 3 commits intoCodeYourFuture:main from
Pezhman-Azizi:implement-shell-tools-js

Conversation

@Pezhman-Azizi
Copy link

@Pezhman-Azizi Pezhman-Azizi commented Dec 12, 2025

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) {
Copy link

@LonMcGregor LonMcGregor Jan 21, 2026

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) {
Copy link

@LonMcGregor LonMcGregor Jan 21, 2026

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

Reviewers

@LonMcGregor LonMcGregor LonMcGregor left review comments

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /