Skip to content

NW | 26-SDC-Mar | TzeMing Ho | Sprint 3 | Implement shell tools exercises#422

Open
TzeMingHo wants to merge 11 commits into
CodeYourFuture:mainfrom
TzeMingHo:coursework/implement-shell-tools
Open

NW | 26-SDC-Mar | TzeMing Ho | Sprint 3 | Implement shell tools exercises#422
TzeMingHo wants to merge 11 commits into
CodeYourFuture:mainfrom
TzeMingHo:coursework/implement-shell-tools

Conversation

@TzeMingHo
Copy link
Copy Markdown

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

I have completed the exercises.

@TzeMingHo TzeMingHo 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. labels Mar 24, 2026
@SlideGauge SlideGauge added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label May 20, 2026
Copy link
Copy Markdown

@SlideGauge SlideGauge left a comment

Choose a reason for hiding this comment

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

I've got a couple of notes from my side could you fix them?

let count = 1;

for (let path of pathsArray) {
const context = await fs.readFile(path, "utf-8");
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 will happen if file does not exist?

const lines = context.trimEnd().split("\n");
if (options.nonBlank) {
lines.forEach((line) => {
if (line.length != 0) {
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 happens if i got a line consisting of whitespace?

const fullPath = `${base.endsWith("/") ? base : base + "/"}${fileName}`;
const stats = await fs.stat(fullPath);
if (stats.isDirectory()) {
return `\x1b[1;34m${fileName}\x1b[0m`;
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 idea to use colour output, the only caveat we should output the color only if we are in terminal mode. I.e. right now if I pass it into a pipe, it will output these codes as well

let numberOfWords = 0;
let numberOfCharacters = 0;

const file = await fs.readFile(path, "utf-8");
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 happens if file is absent?

const options = program.opts();

function padStartNumbers(...args) {
const space = [3, 4, 4];
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 happens if only -c is passed?

@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. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels May 20, 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. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants