-
-
Notifications
You must be signed in to change notification settings - Fork 42
London|25-SDC-NOV| FATMA DEGIRMENCI | Sprint 3|IMPLEMENT_SHELL_TOOLS #272
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?
London|25-SDC-NOV| FATMA DEGIRMENCI | Sprint 3|IMPLEMENT_SHELL_TOOLS #272
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.
Good start on these tasks
Remember to add a short summary to your PRs under the template, so I know what it is you have done.
See also my comments in the files
implement-shell-tools/cat/cat.js
Outdated
| const read = await fs.readFile(path, "utf-8"); | ||
| const lines = read.split("\n"); | ||
| for (let i of lines) { | ||
| if (number) { |
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.
This section has some repetition - two print formats, and two "print a number"s. The nested ifs are also a bit difficult to read. Can you think of any way to tidy this up?
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.
Thanks for feedback
I created a new function to handle the repeated parts.
implement-shell-tools/wc/wc.js
Outdated
| if (opts.w) return `${counts.words} ${filename}`; | ||
| if (opts.c) return `${counts.bytes} ${filename}`; | ||
|
|
||
| return `${counts.lines} ${counts.words} ${counts.bytes} ${filename}`; |
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.
If I request multiple files using *, the numbers dont format into columns. Can you figure out why that happens?
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.
Thanks for the feedback
I used padStart() to align the numbers in columns .
|
Great work! |
Self checklist