London | 6-SDC-Aug | Boshra Mahmoudi | Sprint 3 | Implement shell tools - #652
Conversation
LonMcGregor
left a comment
There was a problem hiding this comment.
Good start, but I think there are some changes that could be made
| import { readFile } from "node:fs/promises"; | ||
| import process from "node:process"; | ||
|
|
||
| const argv = process.argv.slice(2); |
There was a problem hiding this comment.
Is there a library or API you could use to handle arguments for you?
There was a problem hiding this comment.
Hi @LonMcGregor , thanks for raising this. I’ve updated the code to use import { parseArgs } from "node:util";.
| } | ||
|
|
||
| if (files.length > 1 ) { | ||
| if (countLines && countWords) { |
There was a problem hiding this comment.
There's some repeated patterns of code here, can you find a way to reduce it?
There was a problem hiding this comment.
@LonMcGregor , I’ve created a function that can be reused in the main logic, so I don’t need to repeat the same code.
LonMcGregor
left a comment
There was a problem hiding this comment.
Good work. Using a library for argument handling is a good idea as it can be fiddly and difficult to maintain otherwise. Good work refactoring the repeated print pattern
This pull request is related to the Shell pipelines exercise task in the CYF Circulum sprint2.
Task ID: CYF-1150