-
-
Notifications
You must be signed in to change notification settings - Fork 42
West Midlands | SDC-July | Gabriel Deng | Sprint 3 | Implement shell tools #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
LonMcGregor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work implementing these tasks. I have some small comments on ways you could improve them further.
| for (const line of lines) { | ||
| if (options.b) { | ||
| if (line.trim() !== "") { | ||
| console.log(`${(lineNum).toString().padStart(6)} ${line}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is looks like there is some repetition of code across your different output options. Can you think of a way to clean this up?
| const filtered = content.filter((word) => word.charAt(0) !== '.') | ||
|
|
||
| if (opts.one) { | ||
| console.log(filtered.join('\n')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if you run the original ls command with both -a1 options? How does this compare to your implementation?
| totalChars += chars; | ||
|
|
||
| let output = ''; | ||
| if (opts.l) output += `${lines} `; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is quite a bit of duplication in your printing here and where you do total output. Can you think of a way to make this code cleaner?
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above. |
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.