Skip to content

London | 26-SDC-July | Alex Jamshidi | Sprint 3 | Implement shell tools - #635

Open
Alex-Jamshidi wants to merge 5 commits into
CodeYourFuture:mainfrom
Alex-Jamshidi:implement-shell-tools
Open

London | 26-SDC-July | Alex Jamshidi | Sprint 3 | Implement shell tools #635
Alex-Jamshidi wants to merge 5 commits into
CodeYourFuture:mainfrom
Alex-Jamshidi:implement-shell-tools

Conversation

@Alex-Jamshidi

@Alex-JamshidiAlex-Jamshidi commented Jul 30, 2026

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

cat
Handles all commands correctly:
cat sample-files/1.txt
cat -n sample-files/1.txt
cat sample-files/.txt
cat -n sample-files/.txt
cat -b sample-files/3.txt

Stretch:
Handles multiple flags and incorrect flags
(although does not parse b and n correctly when used together)

wc
Handles all commands correctly:
wc sample-files/*
wc -l sample-files/3.txt
wc -w sample-files/3.txt
wc -c sample-files/3.txt
wc -l sample-files/*
wc -w -l sample-files/3.txt
wc -w -l sample-files/*

Stretch:
Handles multiple flags and incorrect flags
Handles flag order

ls
Handles all commands correctly:
ls sample-files
ls sample-files/1.txt
ls sample-files/
ls -1
ls -1 sample-files
ls -1 -a sample-files

Stretch
Handles multiple flags and incorrect flags
Handles flag order

Task ID: CYF-1150

@Alex-JamshidiAlex-Jamshidi 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 Jul 30, 2026
@LonMcGregorLonMcGregor added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Aug 4, 2026

@LonMcGregorLonMcGregor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good start but there is quite a bit of work still to do.

You've built your own argument handling system. Is your way of handling options/arguments always going to be the best? Is there a better way of doing this?

function bFlag() {
return allFilesContents.map((fileContent) => {
let lineNumber = 1;
return fileContent.map((line, index) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A map is typically used to change one array into another using a function that doesn't have side effects. Here, you are changing a lineNumber variable each time the map runs. This isn't wrong, but just be careful of side effects, especially if you ever want to run things asynchronously.


function Flag1() {
if (printInList) {
outputString = outputString.replaceAll("\t", "\n");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I like that you are using lots of task specific functions.

But, is using global variables in this way a safe way of programming this? Is there a way that would have the data flow through your app in a more semantic way?

}

function print() {
if (printInList == true) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Think about how if conditions work, and check this line again. Are you writing code in the most optimal way?

}

function deleteOutputs() {
if (!deleted) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you explain your thinking that led to a design where you need to manually handle your resources like this?

@LonMcGregorLonMcGregor 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 Aug 4, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-ToolsThe name of the module.ReviewedVolunteer to add when completing a review with trainee action still to take.📅 Sprint 3Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@Alex-Jamshidi@LonMcGregor